Skip to main content
Albero Academy

Exploratory Data Analysis

Get to know a dataset before modelling — summary statistics, distributions, relationships, and spotting problems.

Chapter 2Data Science15 min readBeginner friendly
  • #Data Science
  • #EDA
  • #Visualisation

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

the first pass (pandas)
import pandas as pd
df = pd.read_csv("students.csv")
df.info() # columns, types, missing counts
df.describe() # mean/std/min/max for numbers
df["programme"].value_counts() # category frequencies
df.isna().sum() # missing values per column
df.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:

visualising one variable
import matplotlib.pyplot as plt
df["package"].hist(bins=20) # shape of the distribution
plt.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:

two variables
df.plot.scatter(x="experience", y="package")
df.groupby("programme")["package"].mean() # package by category
df[["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

  1. 01EDA is understanding a dataset before modelling — models won't tell you the data is broken.
  2. 02Start with info, describe, value_counts, isna().sum() and corr.
  3. 03Examine single variables (histograms, box plots) for skew and outliers.
  4. 04Examine pairs (scatter plots, grouped means, correlation) for relationships — but correlation ≠ causation.
  5. 05Watch for missing data, outliers, class imbalance and data leakage.