beginnerstatistics

Mean vs Median vs Mode

Three ways to describe the center of your data — and why they disagree.

Key Points

What it is

Mean, median and mode are all measures of central tendency — single numbers that try to represent where the bulk of your data sits. The mean is the sum of all values divided by how many there are. The median is the middle value when all values are sorted. The mode is the value (or values) that appear most frequently.

Why it exists

A dataset of 1000 values is too much to hold in your head at once. A single representative number lets you communicate, compare and make decisions quickly. But data comes in many shapes — sometimes symmetric, sometimes skewed, sometimes categorical — and no single measure works for all shapes. These three measures exist to handle those different situations.

What it measures

All three try to answer the same question — where is the center? — but they define center differently. The mean is the balancing point of the data, pulled by every value including extremes. The median is the geometric middle — half the data falls above it, half below. The mode is the most common value — where data concentrates most densely.

Intuition

Five friends have these annual salaries: 22k, 23k, 21k, 20k, 200k. The mean is 57.2k — but nobody earns close to that. It got dragged up by one outlier. The median is 22k — which actually describes what a typical person in this group earns. The mode does not exist here since all values are unique. Now imagine a shoe store: sizes sold today were 38, 40, 40, 40, 42, 44. The mode is 40 — the most important number for restocking inventory. Mean shoe size is useless for ordering stock.

Example

Dataset: [20, 22, 23, 24, 200]. Mean = 57.8, Median = 23, Mode = none.

Mean gets pulled toward the outlier (200). Median stays at the center. Mode only works when values repeat — here every value is unique so it's undefined.

Formulas

Mean

xˉ=1n∑i=1nxi\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i
  • x̄ — the mean — pronounced x-bar
  • n — total number of values
  • Σ — sum — add up everything
  • xᵢ — each individual value

Median

Median={x(n+1)/2if n is oddxn/2+xn/2+12if n is even\text{Median} = \begin{cases} x_{(n+1)/2} & \text{if } n \text{ is odd} \\ \frac{x_{n/2} + x_{n/2+1}}{2} & \text{if } n \text{ is even} \end{cases}
  • n — number of values (sorted)
  • x_{(k)} — the k-th value in sorted order
  • odd n — median is the middle value
  • even n — median is the average of the two middle values

Mode

Mode=arg⁡max⁡vcount(xi=v)\text{Mode} = \arg\max_{v} \text{count}(x_i = v)
  • v — a possible value in the dataset
  • count — how many times v occurs
  • arg max — the value v with the highest frequency

When to use

When not to use

Common mistakes

In practice

These appear constantly in EDA (Exploratory Data Analysis). In Pandas: df['column'].mean(), .median(), .mode(). The choice of which to use for imputing missing values directly affects model quality — skewed columns should use median imputation. In feature engineering, creating a new column that is the deviation from the median (rather than the mean) is often more robust. Salary, revenue, and time-based columns are almost always right-skewed — always check before using mean.

Was this concept helpful?

Spot an error or gap? Suggest an edit →

Related concepts

variance-standard-deviationnormal-distributionoutliersskewnesshypothesis-testing
Chirp at me!