An Interest In:
Web News this Week
- March 3, 2024
- March 2, 2024
- March 1, 2024
- February 29, 2024
- February 28, 2024
- February 27, 2024
- February 26, 2024
April 28, 2021 04:36 am GMT
Original Link: https://dev.to/gharamelhendy/exploring-data-with-pandas-2j1e
Exploring Data with Pandas
import pandas as pd
df = pd.read_csv('name_of_file.csv')
to display the no of rows and columns, respectively
df.shape
alternative method
print("This data set has {} rows and {} columns".format(df.shape[0], df.shape[1]))
to display first 5 rows
df.head()
to display the data types of each column as well as the number of cells with values (helps to find missing values in each column)
df.info()
alternative method
dataTypeSeries = df.dtypes
print('Data type of each column of Dataframe :')
print(dataTypeSeries)
to check null values
df.isnull()
df.notnull()
to check how may unique values in each column
df.nunique()
a specific column's would be:
df.column_name.nunique()
to check the count, mean, st deviation, min, 25%, 50%, 75%, and max of each of the columns in the data set
df.describe()
Original Link: https://dev.to/gharamelhendy/exploring-data-with-pandas-2j1e
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To