Mean vs median vs mode: which average should you use?
What each average really measures, when each one lies, the exact SQL and pandas lines for all three, and the one-second skew check: mean, median and mode on one page.
Get the free PDF
One page, print-ready, free to share. No signup needed.
One number can gaslight a whole report. Mean, median and mode answer three different questions, and dashboards quietly pick the wrong one all the time. Here is the whole thing on one page. The print-ready A4 PDF is at the bottom.
The three
- Mean: sum / count. Every value counts, which is the feature AND the bug.
- Median: the middle value once sorted.
- Mode: the most frequent value.
When each lies
- Mean + one outlier: one CEO salary skews the whole team's number.
- Median + tiny samples: jumpy under about 30 rows.
- Mode + continuous decimals: every value is unique, so there is no "most frequent".
In SQL
SELECT
AVG(salary) AS mean_salary, -- 72,400
PERCENTILE_CONT(0.5)
WITHIN GROUP (ORDER BY salary)
AS median_salary -- 48,000
FROM team;
Both numbers are correct. Only one describes a person who exists. For the mode: GROUP BY salary ORDER BY COUNT(*) DESC LIMIT 1.
In pandas
s.mean(): the mean.s.median(): the median.s.mode()[0]: the mode, first one if tied.
Pick one
- Salaries, prices, delays: median.
- Categories, shoe sizes: mode.
- Symmetric data with no outliers: the mean is fine, and it sums back to totals.
The trap table
| You used | It breaks when | Reach for |
|---|---|---|
| mean | outliers exist (money, delays) | median |
| median | you need totals back | mean, plus a note |
| mode | values are continuous | binned mode or median |
Cheap tell in one second: mean far above median means right skew, a few big values dragging it up. Look at the distribution before you report either.
Frequently asked questions
What is the difference between mean, median and mode?
When should you use the median instead of the mean?
How do you calculate the median in SQL?
What does it mean when the mean is higher than the median?
Get the free PDF
One page, print-ready, free to share. No signup needed.