Mean vs Median vs Mode
Three ways to describe the center of your data — and why they disagree.
Key Points
- Mean = sum ÷ count. Sensitive to outliers. Best for symmetric data.
- Median = middle value when sorted. Robust to outliers. Best for skewed data like income or prices.
- Mode = most frequent value. Only meaningful measure for categorical data.
- In a perfectly normal distribution, mean = median = mode. Real data is rarely perfect.
- For missing value imputation: skewed columns → use median, not mean.
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
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̄— the mean — pronounced x-barn— total number of valuesΣ— sum — add up everythingxᵢ— each individual value
Median
n— number of values (sorted)x_{(k)}— the k-th value in sorted orderodd n— median is the middle valueeven n— median is the average of the two middle values
Mode
v— a possible value in the datasetcount— how many times v occursarg max— the value v with the highest frequency
When to use
- Use mean when data is roughly symmetric with no significant outliers — e.g. heights, test scores in a large class
- Use median when data is skewed or has outliers — income, house prices, response times, anything where a few extreme values exist
- Use mode when data is categorical — most common product category, most frequent error code, most popular item
- Use mode for discrete data where repetition is meaningful — shoe sizes, number of children per household
- Report all three during EDA to understand the shape of your data before choosing which to use downstream
When not to use
- Do not use mean with heavily skewed data — one extreme outlier can make the mean unrepresentative of the entire rest of the dataset
- Do not use mode as the primary summary for continuous data — values rarely repeat exactly so mode is often undefined or meaningless
- Do not use median when you need a value that accounts for the total — total revenue depends on the sum, not the middle
- Do not report only one measure without checking whether the data is symmetric — always look at all three before deciding
Common mistakes
- Using mean salary to describe a company's pay without checking for executive outliers — mean becomes misleading, median is the honest number
- Assuming mean and median are always close — they diverge significantly whenever data is skewed, which is common in real-world DS data
- Forgetting that mode can return multiple values in a multimodal distribution — two equally common values is a signal worth investigating, not an error to ignore
- Using mean to impute missing values in a skewed column — this is one of the most common ways to silently bias a model
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?
Related concepts