Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 28, 2021 04:36 am GMT

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:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To