Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To explore the dataset, we can start with the following EDA queries:
- Load the dataset into a pandas dataframe and check the first 5 rows to see what the data looks like.
- python
- Copy code
- import pandas as pd
- df = pd.read_csv("filename.csv")
- df.head()
- Check the data types of each column to make sure they are correct.
- python
- Copy code
- df.dtypes
- Check the number of rows and columns in the dataframe.
- python
- Copy code
- df.shape
- Check for any missing or null values in the dataframe.
- python
- Copy code
- df.isnull().sum()
- Check the distribution of the numerical variables using describe().
- python
- Copy code
- df.describe()
- Check the correlation between the numerical variables.
- python
- Copy code
- df.corr()
- Group the data by Artist and check the count of songs by each artist.
- python
- Copy code
- df.groupby('Artist')['song name'].count()
- Create a histogram of the danceability column to see the distribution.
- python
- Copy code
- import matplotlib.pyplot as plt
- %matplotlib inline
- plt.hist(df['danceability'], bins=20)
- plt.show()
- Create a scatter plot of danceability and energy to see if there is any correlation.
- python
- Copy code
- plt.scatter(df['danceability'], df['energy'])
- plt.show()
- Check the unique values for the key column.
- python
- Copy code
- df['key'].unique()
- These EDA queries can help us understand the data better and identify any issues with the data. Based on the results, we can decide how to proceed with data cleaning and further analysis.
Advertisement
Add Comment
Please, Sign In to add comment