Powering Up Your Pandas Part I — Understanding The Essentials

Photo by Yu Wang on Unsplash

Basic functions

Importing the pandas

import pandas as pd

Reading the dataset

df = pd.read_csv('IRIS.csv')

Display all data

df

Head()

df.head() # Displaying first 5 columns
df.head(10) # Displaying first 10 columns

Tail()

df.tail() # Displaying last 5 columns
df.tail(10) # Displaying last 10 columns

Shape

df.shape

Columns

df.columns

Isnull() / isna()

df.isnull().sum() or df.isna().sum()

Duplicates()

df.duplicated().sum()

Dtypes

  • object: This types consist of mixed types of data that stored in a columns, usually string will refer as object (“Cold”, “Old”, “New”, etc).
  • float64: This types consist of floating values (0.5, 4.1, 2.2, etc).
  • int64: This type consist of integer values (1, 100, 5000, etc).
  • datetime64[ns]: This type consist of datetime format (‘2021–03–10", “2021–04–15", “2021–05–20”, etc).
df.dtypes

Values

df.values

Unique()

df['column_names'].unique() or df.column_names.unique()

Info()

df.info()

Describe()

df.describe()

Conclusion

Next Work

Source

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store