Before analyzing or cleaning a dataset, it's important to understand what you're working with. Pandas provides several simple methods to quickly explore and summarize your data.
Here are a few of the most common Pandas methods for exploring a DataFrame:
df.head() — shows the first 5 rowsdf.tail() — shows the last 5 rowsdf.shape — returns the number of rows and columnsdf.info() — displays column types and non-null countsdf.describe() — gives summary statistics for numerical columnsimport pandas as pd
df = pd.read_csv("sales.csv")
print(df.head())
print(df.shape)
print(df.describe())