Exploratory Data Analysis is the detective work you do before modelling — understanding what's in the data, what's wrong with it, and what looks interesting. Skipping EDA is the fastest way to build a model on flawed data and never notice.
Why EDA?
Models can't tell you your data is broken — they'll happily learn from a mislabelled column or an outlier. EDA is how you catch problems and form hypotheses. It's part statistics (the statistics tutorial) and part visualisation.
Summarise
import pandas as pddf = pd.read_csv("students.csv")df.info() # columns, types, missing countsdf.describe() # mean/std/min/max for numbersdf["programme"].value_counts() # category frequenciesdf.isna().sum() # missing values per columndf.corr(numeric_only=True) # correlations between numeric columns
Distributions
Look at one variable at a time. Is it skewed? Are there outliers? A histogram answers instantly:
import matplotlib.pyplot as pltdf["package"].hist(bins=20) # shape of the distributionplt.show()df.boxplot(column="package") # median, quartiles, outliers
Relationships
Then look at pairs of variables. Does package rise with experience? A scatter plot and a correlation number tell you:
df.plot.scatter(x="experience", y="package")df.groupby("programme")["package"].mean() # package by categorydf[["experience", "package"]].corr() # linear correlation
Spotting problems
- Missing data — how much, and is it random or systematic?
- Outliers — real extreme values, or data-entry errors?
- Imbalance — if 98% of rows are one class, accuracy is misleading (Chapter 4).
- Leakage — a column that secretly encodes the answer will make a model look perfect and fail in production.
Practice
On any dataset, run info, describe and isna().sum(), plot a histogram of one numeric column, and a scatter of two you think are related. Write down two things that surprised you and one data-quality problem to fix.
Key takeaways
- 01EDA is understanding a dataset before modelling — models won't tell you the data is broken.
- 02Start with info, describe, value_counts, isna().sum() and corr.
- 03Examine single variables (histograms, box plots) for skew and outliers.
- 04Examine pairs (scatter plots, grouped means, correlation) for relationships — but correlation ≠ causation.
- 05Watch for missing data, outliers, class imbalance and data leakage.
