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.
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.
Worked example
Here are the heights, in centimetres, of 7 people: [150, 155, 160, 160, 170, 175, 180].
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 added | New 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.
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.
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
- Sort the data from smallest to largest.
- If there's an odd number of values, the median is the middle one.
- 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.
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.
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:
- No mode, when every value appears equally often.
- One mode (unimodal), when one value clearly appears most.
- Two modes (bimodal), when two values tie for the top spot.
- Several modes (multimodal), when more than two values tie.
Worked example: categories
A shop records how each of its last eight customers paid:
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].
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:
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.
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:
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.
| Measure | Best used when | Avoid when |
|---|---|---|
| Mean | The data is roughly balanced, has no big outliers, and is on an interval or ratio scale | The data is skewed or has outliers |
| Median | The data is skewed, has outliers, or is ordinal | You need a value to feed into calculations built on the mean, like variance |
| Mode | The data is nominal, or you want the most popular value | The data is continuous with few repeats, since there may be no meaningful mode |
| Weighted mean | Values matter unequally, like credits or order sizes | There's no good reason to weight |
| Trimmed mean | You want a mean that a few extreme values can't hijack | The extremes are the thing you care about |
| Geometric mean | Values compound, like growth rates and returns | The data has zeros or negative values |
A rule of thumb
- Is the data nominal? Use the mode.
- Is it ordinal, skewed, or full of outliers? Use the median.
- 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 shape | Typical order | What it means |
|---|---|---|
| Symmetric | Mean = median = mode | The data is balanced around its centre |
| Right-skewed (positive skew) | Mode < median < mean | A long tail of large values is pulling the mean up |
| Left-skewed (negative skew) | Mean < median < mode | A long tail of small values is pulling the mean down |
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).
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.
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.
- Mean: uses every value, so it's the best summary of clean, balanced data, and the easiest to drag off course.
- Median: barely affected by outliers, so it's the safer choice for skewed or messy data, and it works for ordinal data too.
- Mode: the most common value, and the only measure that works for nominal data.
- And the variants: weight the mean when values matter unequally, trim it when a few extremes shouldn't decide the answer, and use the geometric mean when values compound.
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.
Range, variance, standard deviation, MAD and the IQR in depth, because knowing the centre of your data is only half the story.