Skip to main content
Albero Academy

Descriptive Statistics

Mean, median, mode, variance, standard deviation, percentiles — the toolkit for summarising any dataset.

Chapter 1Statistics14 min readBeginner friendly
  • #Statistics
  • #Descriptive

Before any modelling, A/B test, or machine-learning pipeline, you summarise your data. Descriptive statistics are the toolkit — six numbers that tell you almost everything about a column.

Why descriptive stats?

  • Spot data-quality issues — outliers, wrong units, encoding errors.
  • Choose the right model — many ML algorithms assume roughly-normal features.
  • Communicate results — "median order value rose 12%" is easier than dumping a CSV.

Measures of central tendency

MeasureFormula / definitionWhen to prefer it
Mean (μ)sum / nno extreme outliers, roughly-symmetric data
Medianmiddle value (sorted)skewed data, presence of outliers
Modemost frequent valuecategorical data; multimodal distributions

Measures of spread

MeasureWhat it tells you
Rangemax − min (very sensitive to outliers)
Variance (σ²)average squared deviation from the mean
Std deviation (σ)√variance — same units as the data
IQRQ3 − Q1 (robust to outliers)

For a roughly normal distribution, the 68/95/99.7 rule holds:

  • ~68% of values fall within 1σ of the mean
  • ~95% within 2σ
  • ~99.7% within 3σ

Percentiles & quartiles

The Pth percentile is the value below which P% of the data falls. Quartiles (Q1, Q2, Q3) are the 25th, 50th, 75th percentiles. The Inter-Quartile Range (IQR) = Q3 − Q1.

Standard outlier rule: any value below Q1 − 1.5·IQR or above Q3 + 1.5·IQR is flagged as an outlier (this is what box-plot whiskers visualise).

Skewness & kurtosis

  • Skewness measures asymmetry. Right-skew (positive) is common in income & revenue data — a long right tail.
  • Kurtosis measures tail-heaviness. High kurtosis = more extreme outliers than a normal distribution would predict.

Computing them in Python

Python
import numpy as np
import pandas as pd
salaries = pd.Series([35, 42, 50, 58, 60, 60, 72, 90, 110, 350])
print(salaries.mean()) # 92.7 — pulled up by the 350
print(salaries.median()) # 60.0 — robust
print(salaries.mode().tolist()) # [60]
print(salaries.std()) # 95.4
print(salaries.var()) # 9106
print(salaries.quantile([0.25, 0.5, 0.75]))
print(salaries.describe()) # all of the above in one go
# Custom: compute the 95th percentile
print(np.percentile(salaries, 95))

Key takeaways

  1. 01Mean is sensitive to outliers; median is robust. Default to median for skewed data.
  2. 02Standard deviation has the same units as your data; variance is in units squared.
  3. 03For a normal distribution: ~68/95/99.7 of values lie within 1/2/3 std devs.
  4. 04Outliers are values outside Q1 − 1.5·IQR or Q3 + 1.5·IQR.
  5. 05In Python, df.describe() prints all the descriptives at once — start there every time.