Faced with a new dataset, beginners often freeze: where do I start, and when am I done? A checklist solves both problems. It makes sure you never skip an important check, and it gives every EDA the same reliable shape.
This lesson gives you 20 questions to ask any dataset, grouped into five stages, with the pandas code that answers each one. Keep it open the next time you meet new data.
The examples assume a DataFrame called df and these imports:
import pandas as pd
import matplotlib.pyplot as plt
Stage 1: context
Answer these before writing any code. They need people and documentation, not pandas.
1. What question are we trying to answer? "Why are customers leaving?" needs different checks from "how many customers do we have?". Write the question down.
2. What does one row represent? One customer? One order? One customer per month? Getting this wrong breaks every count.
3. Where did the data come from, and how was it collected? A survey, a website log, a manual spreadsheet? Each has typical errors: survey answers are self-reported, logs miss offline activity, spreadsheets have typos.
4. What does each column mean, and in what units? Is amount in rupees or thousands of rupees? Does status = 0 mean active or cancelled? Find the data dictionary, or ask.
Stage 2: structure
5. How big is it?
df.shape # (rows, columns)
6. What do the rows look like?
df.head() # first 5 rows
df.sample(5, random_state=0) # 5 random rows: often more revealing
7. What are the column names and types?
df.info() # types, non-null counts, memory
df.dtypes
Watch for numbers stored as object (text), which usually means a stray symbol or text like "N/A" inside. Data types, memory and categorical columns covers types in detail.
8. Is there a unique ID, and is it really unique?
df["order_id"].is_unique
Stage 3: quality
9. Which values are missing, and how many?
df.isna().sum().sort_values(ascending=False)
df.isna().mean().round(3) # as a share of rows
10. Are there duplicate rows?
df.duplicated().sum()
11. Are there impossible or suspicious values? Negative ages, quantities of 0, dates in the future, 999 used as "unknown".
df.describe() # look hard at min and max
12. Are categories consistent? "Delhi", "delhi" and " Delhi " are three different values to pandas.
df["city"].value_counts()
The data cleaning module shows how to fix each of these problems, starting with handling missing values.
Stage 4: one column at a time
13. How is each numeric column distributed? Centre, spread, skew, peaks.
df["price"].describe()
df["price"].hist(bins=30)
plt.show()
14. Are there outliers?
df.boxplot(column="price")
plt.show()
15. How common is each category?
df["city"].value_counts(normalize=True)
16. If there's a target (something to predict), how is it distributed? For yes/no targets, check the balance: 98% "no" makes accuracy a misleading score.
df["churned"].value_counts(normalize=True)
Stage 5: relationships
17. Which numeric columns move together?
df.corr(numeric_only=True).round(2)
18. How does the target differ across groups?
df.groupby("city")["churned"].mean().sort_values()
19. Does anything change over time?
df.set_index("date")["sales"].resample("ME").sum().plot()
plt.show()
("ME" means month end; older pandas versions use "M".)
20. What did we learn, and what should happen next? Write a short list of findings, problems to fix, and new questions. EDA that isn't written down is quickly forgotten.
The checklist at a glance
| Stage | Questions | Key tools |
|---|---|---|
| Context | 1–4: goal, row meaning, source, column meanings | Documentation, people |
| Structure | 5–8: size, rows, types, IDs | shape, head, sample, info, is_unique |
| Quality | 9–12: missing, duplicates, impossible values, categories | isna, duplicated, describe, value_counts |
| One column | 13–16: distributions, outliers, categories, target | hist, boxplot, value_counts |
| Relationships | 17–20: correlations, groups, time, findings | corr, groupby, resample |
A reusable first-look function
Stages 2 and 3 are the same for every dataset, so wrap them in a function:
def quick_report(df):
print(f"Rows: {len(df):,} Columns: {df.shape[1]}")
print(f"Duplicate rows: {df.duplicated().sum()}")
summary = pd.DataFrame({
"type": df.dtypes.astype(str),
"missing": df.isna().sum(),
"missing %": (df.isna().mean() * 100).round(1),
"unique": df.nunique(),
})
print(summary)
Try it on the Titanic data:
Download the data: titanic.csv (58 KB), or from the original source, the seaborn-data repository on GitHub. The code below loads it for you, so you only need the file to open it in a spreadsheet or work offline: load it with
pd.read_csv("titanic.csv").
import seaborn as sns
titanic = sns.load_dataset("titanic")
quick_report(titanic[["survived", "pclass", "sex", "age", "fare", "embarked", "deck"]])
Rows: 891 Columns: 7
Duplicate rows: 115
type missing missing % unique
survived int64 0 0.0 2
pclass int64 0 0.0 3
sex object 0 0.0 2
age float64 177 19.9 88
fare float64 0 0.0 248
embarked object 2 0.2 3
deck category 688 77.2 7
One call gives a page of first findings: age and deck need attention, and there seem to be 115 duplicate rows. Duplicates need care here, though. With no passenger ID or name in these columns, two different people of the same sex, class, age and fare look identical. Remove duplicate rows explains how to tell real duplicates from look-alikes.
Practice
- Which checklist question would catch prices stored as text like "₹1,200"?
Show the answer
Question 7, column types: the column shows as object instead of a number type in df.info().
- Add a "most common value" column to
quick_report.
Show the answer
Add this entry to the dictionary: "top": df.mode().iloc[0]. mode() returns the most frequent value of each column; its first row holds one most-common value per column.
- Your dataset has one row per customer per month. Why does this matter when you count customers?
Show the answer
len(df) counts customer-months, not customers. Count unique customers with df["customer_id"].nunique().
Interview questions
What are the first things you check in a new dataset?
Its context (what a row means, where it came from), its size and column types, missing values, duplicates, impossible values and inconsistent categories, then distributions and relationships, especially with the target.
Why look at a random sample rather than just head()?
The first rows are often not typical: files are frequently sorted by date or ID, so head() can show only the oldest records or one category. A random sample gives a fairer picture.
Why check the target's distribution early?
To spot class imbalance, which affects which metrics and models make sense, and to catch problems such as missing or mislabelled target values before modelling.
What to learn next
- Run stages 2 and 3 in detail in first look at a dataset: head(), info() and describe().
- Understand column types in data types, memory and categorical columns.