Measures of Central Tendency

The mean, median and mode: three ways to sum up a whole column in one number, and how to know which one is telling you the truth.

[150, 155, 160, 160, 170, 175, 180, 500]

Mean206.25dragged up by the 500
Median165the middle value
Mode160the most common
Eight heights in centimetres, one of them a typo. Ask for "the average" and you can get three different answers. This article is about which one to believe.

On Day 2 we learned to sort data by type and scale. Now that we know what kind of data we have, the next question is simple: how do we sum it all up in one number? That's what today is about.

Why summarise data at all?

Imagine someone hands you a dataset of 10,000 customer purchases. You can't stare at 10,000 numbers and understand what's going on. You need one number that tells you where most of the data sits: the "centre" of your data.

That's exactly what measures of central tendency do. The three most common are the mean, the median, and the mode. You might think one of them should be enough, but each does a different job. By the end of this article you'll know when to use which, and why.

The centre is only half the story

Knowing where your data is centred doesn't tell you how spread out it is. That's called dispersion, and it covers measures like variance and standard deviation. Day 1 touched on a few of them (standard deviation, IQR, MAD), and Day 4 goes much deeper.

The mean

The mean is what most people simply call "the average". It's the most widely used measure of central tendency: add up all the values, then divide by how many there are. For a whole population it's written with the Greek letter μ (mu). For a sample, it's written x̄ ("x-bar"), the same parameter-versus-statistic distinction from Day 1.

μ = x1 + x2 + ⋯ + xnn = ∑ xin
n is the number of values and xi is each individual value. The sample mean x̄ uses exactly the same calculation.

Worked example

Here are the heights, in centimetres, of 7 people: [150, 155, 160, 160, 170, 175, 180].

μ = 150 + 155 + 160 + 160 + 170 + 175 + 1807 = 11507 ≈ 164.3 cm
Pythonimport numpy as np data = [150, 155, 160, 160, 170, 175, 180] print(np.mean(data))
Output164.28571428571428

The outlier problem

The mean uses every single value. That's its strength and its weakness: change any one value and the mean changes too. So one far-off number, an outlier, can drag it a long way. Watch what happens when we add an 8th person:

8th value addedNew mean
170 (an ordinary height)165.0
500 (an outlier)206.25

With the 500 in the list, the mean jumps to 206.25 cm, yet nobody in the data is anywhere near that tall. And no human is 500 cm tall at all. In real datasets, a value like this is usually a typing mistake, someone who meant 150 or 160. That's one more reason to look at your data before trusting any summary of it.

The same problem, at the scale of a city

Picture a town where 999 people earn $40,000 a year and one billionaire earns $1,000,000,000. The mean income is $1,039,960, over a million dollars a year. Yet the typical person there earns $40,000, which is exactly what the median says. One extreme value makes the mean describe nobody. It's Day 1's $200K salary lesson again, just much bigger.

When values don't count equally: the weighted mean

The plain mean treats every value as equally important. Often they aren't. If you've studied at an Indian university, you've already met the fix: your CGPA. A 4-credit course should count for more than a 2-credit one, so each grade is multiplied by its credits before averaging. That's a weighted mean: multiply each value by its weight, add those up, and divide by the total weight.

Pythongrades = np.array([9, 7, 8, 10]) # grade points in four courses credits = np.array([4, 4, 3, 2]) # credits for each course print("Simple mean: ", grades.mean()) print("Weighted mean:", round(np.average(grades, weights=credits), 2))
OutputSimple mean: 8.5 Weighted mean: 8.31

The simple mean says 8.5, but the 10 came from a small 2-credit course and the 7 from a big 4-credit one, so the honest figure is 108 ÷ 13 ≈ 8.31. You'll meet weighted means everywhere: average price paid across orders of different sizes, exam scores with sections worth different marks, and survey results weighted so each region counts in proportion to its population.

The median

The median is the middle value once the data is sorted from smallest to largest. Half the values sit below it and half above. It only cares about position, which value is in the middle, not how big the other numbers are. That's why outliers barely touch it.

How to calculate it

  1. Sort the data from smallest to largest.
  2. If there's an odd number of values, the median is the middle one.
  3. If there's an even number, the median is the average of the two middle values.

Worked example

Our 7 heights, sorted: [150, 155, 160, 160, 170, 175, 180]. The middle (4th) value is 160, so that's the median.

Pythonprint(np.median(data))
Output160.0

Add an 8th value of 170: [150, 155, 160, 160, 170, 170, 175, 180]. Now there are two middle values, 160 and 170, so the median is (160 + 170) ÷ 2 = 165.

Add the outlier 500 instead: [150, 155, 160, 160, 170, 175, 180, 500]. The two middle values are still 160 and 170, so the median is still 165.

Whether the 8th person was an ordinary 170 cm or an impossible 500 cm, the median came out exactly the same. The mean, meanwhile, swung from 165 to 206.25. Being unmoved by extreme values has a name: robustness.

150 200 300 400 500 Mean = 206.25 Median = 165 500 cm, a typo 7 real heights, 150 to 180 cm 150 300 400 500 Mean = 206.25 Median = 165 500 cm, a typo 7 real heights, 150 to 180 cm
One typo pulls the mean up by about 42 cm, higher than every real height in the group. The median stays with the people who actually exist.
When to use the median instead of the mean

Use the median whenever your data has outliers or is skewed (lopsided), like income, house prices, or how long people wait for something. It gives a much more honest picture of what's "typical".

That's why official income statistics lead with it. The US Census Bureau's annual income report puts the median front and centre: its headline figure for 2023 was a real median household income of $80,610. Household incomes are heavily right-skewed, so a mean would be pulled upward by the very highest earners and describe almost nobody.

The mode

The mode is the value that appears most often. Unlike the mean and median, it works on categories as well as numbers. For nominal data, the label-only kind from Day 2, it's the only one of the three that makes sense. (Ordinal data can use the median as well, as we'll see in a moment.)

A dataset can have:

Worked example: categories

A shop records how each of its last eight customers paid:

Pythonimport pandas as pd payments = pd.Series(["UPI", "Card", "UPI", "Cash", "UPI", "NetBanking", "Card", "UPI"]) print(payments.value_counts().to_string()) print("Mode:", payments.mode().tolist())
OutputUPI 4 Card 2 Cash 1 NetBanking 1 Mode: ['UPI']

The mode is UPI. Payment method is nominal: there's no way to add up "UPI" and "Cash" for a mean, and no natural order to find a middle one. The mode is the only measure that applies.

Ordinal categories are different. Take a list of customers' education levels: [Bachelor's, Master's, High School, Bachelor's, PhD, Master's, Bachelor's, Bachelor's]. The mode is Bachelor's (it appears 4 times). But education has a natural order, from High School to PhD, so you can also sort the list and find its middle: High School, Bachelor's, Bachelor's, Bachelor's, Bachelor's, Master's, Master's, PhD. The two middle values are both Bachelor's, so the median is Bachelor's too. That's the ordinal median from Day 2, used for real.

Worked example: two modes

Now some numbers: [12, 15, 15, 18, 20, 20, 22, 25].

1 12 2 15 1 18 2 20 1 22 1 25 how many times each value appears 1 12 2 15 1 18 2 20 1 22 1 25 how many times each value appears
Two values tie for the tallest bar, which makes this data bimodal.

Both 15 and 20 appear twice, more than any other value, so the data is bimodal. In real data, two peaks are often a clue that two different groups have been mixed into one column: two age groups, say, or casual and business customers. Be careful which tool you ask, though:

Pythonfrom scipy import stats values = [12, 15, 15, 18, 20, 20, 22, 25] print("scipy: ", stats.mode(values)) print("pandas:", pd.Series(values).mode().tolist())
Outputscipy: ModeResult(mode=np.int64(15), count=np.int64(2)) pandas: [15, 20]

SciPy reports only one mode: when values tie, it returns the smallest, so 20 silently disappears. Pandas returns every tied value. If you used SciPy alone, you'd never know your data had two peaks. (The np.int64(15) is just how recent versions of NumPy display a number. It's still 15.)

Two more averages worth knowing

The trimmed mean: a compromise

Mean and median aren't the only choices. A trimmed mean sorts the data, cuts off a fixed percentage from each end, and averages what's left. It's still a genuine mean, just with the most extreme values removed first.

Pythonheights_with_outlier = [150, 155, 160, 160, 170, 175, 180, 500] print("Mean: ", np.mean(heights_with_outlier)) print("Median: ", np.median(heights_with_outlier)) print("Trimmed mean:", stats.trim_mean(heights_with_outlier, 0.125))
OutputMean: 206.25 Median: 165.0 Trimmed mean: 166.66666666666666
150 200 300 400 500 Mean = 206.25 Median = 165 Trimmed mean = 166.7 trimmed lowest trimmed 150 300 400 500 Mean = 206.25 Median = 165 Trimmed mean = 166.7 trimmed lowest trimmed
Cut the lowest and highest value, then average the remaining six. The trimmed mean lands right beside the median.

Cutting 12.5% from each end of 8 values removes exactly one value from each side: the 150 and the 500. The remaining six average to 1000 ÷ 6 ≈ 166.7, right next to the median.

Sports judging uses the same idea to stop one judge from deciding the result. In Olympic diving, seven judges score each dive, the two highest and two lowest scores are thrown out, and only the middle three count toward the dive's score (multiplied by the dive's degree of difficulty). One unusually generous or harsh judge simply gets dropped.

The geometric mean: for growth rates

Day 2 mentioned that ratio data allows a geometric mean. Here's where you'd actually need it. Say an investment grows 50% one year and falls 50% the next. The ordinary average of +50% and −50% is 0%, which suggests you broke even. You didn't:

Pythongrowth = [1.5, 0.5] # +50% is a factor of 1.5, -50% is a factor of 0.5 print("Start with 100, end with:", 100 * 1.5 * 0.5) print("Geometric mean factor: ", round(stats.gmean(growth), 4))
OutputStart with 100, end with: 75.0 Geometric mean factor: 0.866

You ended with 75, a loss of a quarter. The geometric mean multiplies the growth factors and takes the root (the square root here, for two years): √(1.5 × 0.5) ≈ 0.866, a typical change of about −13.4% per year. Two years at −13.4% takes 100 to 75, exactly what really happened. Whenever values compound, like returns, growth rates, or price changes over time, the geometric mean is the right average.

Choosing the right measure

This may be the most useful part of the article. Picking the wrong measure can lead you straight to the wrong conclusion.

MeasureBest used whenAvoid when
MeanThe data is roughly balanced, has no big outliers, and is on an interval or ratio scaleThe data is skewed or has outliers
MedianThe data is skewed, has outliers, or is ordinalYou need a value to feed into calculations built on the mean, like variance
ModeThe data is nominal, or you want the most popular valueThe data is continuous with few repeats, since there may be no meaningful mode
Weighted meanValues matter unequally, like credits or order sizesThere's no good reason to weight
Trimmed meanYou want a mean that a few extreme values can't hijackThe extremes are the thing you care about
Geometric meanValues compound, like growth rates and returnsThe data has zeros or negative values

A rule of thumb

  1. Is the data nominal? Use the mode.
  2. Is it ordinal, skewed, or full of outliers? Use the median.
  3. None of the above? Use the mean, weighted if the values aren't equally important.

What the gaps tell you about shape

Where the mean, median, and mode land relative to each other can tell you something about the shape of your data.

Distribution shapeTypical orderWhat it means
SymmetricMean = median = modeThe data is balanced around its centre
Right-skewed (positive skew)Mode < median < meanA long tail of large values is pulling the mean up
Left-skewed (negative skew)Mean < median < modeA long tail of small values is pulling the mean down
Symmetric mean = median = mode balanced Right-skewed Mode Median Mean long tail on the right Left-skewed Mean Median Mode long tail on the left Symmetric mean = median = mode balanced Right-skewed Mode Median Mean long tail on the right Left-skewed Mean Median Mode long tail on the left
Real curves with their true mean, median, and mode marked. The right-skewed curve here has its mode at 1, median at 1.68, and mean at 2: the mean is dragged furthest toward the long tail.
A practical habit

If the mean and median in your dataset are far apart, that's a strong hint the data is skewed, so go look for outliers. Comparing them is one of the first checks in exploratory data analysis (EDA).

This rule has exceptions

The "typical order" column is a rule of thumb, not a law. In 2005, the statistician Paul von Hippel showed in the Journal of Statistics Education that it fails surprisingly often, especially for whole-number data and data with more than one peak. One of his examples: the number of adults in a household is clearly right-skewed, yet its mean sits below its median, the opposite of what the rule predicts. So treat the order as a clue, not a promise, and look at the actual shape of your data before concluding anything.

Case study: what's the "average order"?

An online store wants to report its average order value for the month. Most orders are everyday purchases priced between $19 and $79, but a handful are bulk orders from businesses worth $5,000 or more. Here's a reproducible version of that month: 485 ordinary orders and 15 bulk ones.

Pythonrng = np.random.default_rng(7) regular = rng.choice([19, 29, 39, 49, 59, 79], size=485, p=[0.12, 0.30, 0.20, 0.18, 0.12, 0.08]) bulk = rng.integers(5000, 9001, size=15) orders = pd.Series(np.concatenate([regular, bulk])) print("Mean: ", round(orders.mean(), 2)) print("Median:", orders.median()) print("Mode: ", orders.mode().tolist()) print("Orders below the mean:", f"{(orders < orders.mean()).mean():.0%}")
OutputMean: 253.64 Median: 39.0 Mode: [29] Orders below the mean: 97%

If an analyst reported "average order value: $253.64", the business might plan stock, delivery, and marketing around customers who spend about $250. But 97% of orders are below that figure. The median ($39) describes a typical order, the mode ($29) is the most common basket, and the mean mostly reflects 15 business orders. The honest report gives all three, and says why they differ.

Key takeaway

The mean, median, and mode aren't rivals for the same job. Each tells you something different. In any real project, compute all three and compare them: the gaps between them tell you as much as the numbers themselves.

Quick check

Four questions to test whether this stuck. The answers are one click away.

Nine house prices have a mean of $450,000 and a median of $310,000. What does that gap tell you?

The data is probably right-skewed, most likely because one or a few expensive houses are pulling the mean up. The median, $310,000, is the more honest description of a "typical" house in this set.

Why can't you compute a mean or median for a column of favourite pizza toppings?

Because topping names are nominal: there's nothing to add up, and no meaningful order to find the middle of. The mode, the most popular topping, is the only measure of central tendency that applies.

A dataset is perfectly symmetric but has two equally common peaks, like a class where one group studied and one didn't. What happens to "mean = median = mode"?

It breaks down. The mean and median can still land together in the middle, but there's no single mode, because two values tie for most common, and the middle may be a score almost nobody got. It's exactly the kind of shape the "this rule has exceptions" callout warned about.

A portfolio doubles in value one year, then halves the next. What was the average yearly return?

The ordinary average of +100% and −50% is +25%, which sounds great, but 100 becomes 200 and then 100 again: no gain at all. The geometric mean gets it right: √(2 × 0.5) = 1, a factor of 1 per year, which is a 0% return.

Next up, Day 4 Measures of Dispersion

Range, variance, standard deviation, MAD and the IQR in depth, because knowing the centre of your data is only half the story.