When the Mean Lies
2184. Vault-9, financial memory compartment
Kotomarket's black box has released a new layer: order values. Thousands of purchases include $3.00 scratching posts, $7.00 bags of food, and the occasional order worth hundreds of dollars. Someone in Tailford was regularly furnishing entire rooms for their cats.
QUERY prints the first summary:
Average order value — $10.20. Median — $7.50. The mean is 36% higher than the median. This is not an error. I checked. Repeatedly.
L., entry #41: “The director showed investors the average order value again. I showed them the median. I was asked to leave.”
You already know how to calculate the mean, median, and quantiles from the “First Look at the Data” chapter. That's also where you learned to build a histogram. This chapter starts one step further: the question is no longer “how do I calculate it?” but which number belongs in the report and what exactly it says about the data.
First: the unit of observation
Before you say “average,” ask: average WHAT? In the order table, one row represents one order. That means both the mean and the median describe orders, not people. One person could place five orders and appear in the table five times.
This immediately shows why “the average customer spends $10.20” fails in two ways. First, the right tail pulls the mean upward. Second, the unit of observation is not a customer at all. To talk about customers, you first need to the data by user_id — which produces a DIFFERENT table with a different distribution. Many arguments about “averages” in team meetings are really arguments between people averaging different units of observation without realizing it.
What the mean and median actually promise
| Metric | What it tells you about the data | Resistance to very large orders |
|---|---|---|
Mean (mean) | Preserves the total: mean × number of orders = total revenue. So the mean lets you recover the total | Low: a single $420.00 order noticeably pulls the mean upward |
Median (median) | Splits the sorted orders in half: at least half of the orders cost no more than the median, and at least half cost no less | High: increase the largest order by another $10,000.00 and the median won't move |
Both metrics are valid; they answer different questions. Trouble starts when one is presented as though it answers the other's question. Notice what the table does not contain: a row labeled “the correct metric.” The right choice depends on the task.
If you need to connect order value to total revenue, use the mean together with the number of orders: their product gives you revenue. If you want the center of a skewed distribution without rare large orders having too much influence, use the median. If you're trying to describe a typical order, inspect the shape of the distribution first. With several distinct groups, neither the mean nor the median may be typical of any group. When you need both, which is often the case, show them side by side.
Why they diverged
Because order values are distributed asymmetrically. On the left, there is a hard boundary at $0.00: an order cannot cost less than zero. There is no similar nearby boundary on the right; an order can cost $420.00. Most order values cluster near the lower amounts, while a few expensive orders stretch the distribution to the right. This shape is called right-skewed: the right tail is longer than the left.
In a symmetric distribution with a single center, the mean and median are usually close. As rare expensive orders contribute more to the right tail, the mean moves farther to the right of the median because it reflects the size of every order and must preserve the total.
QUERY: When someone shows you one number instead of the distribution, that's not a report. It's an alibi.
Investigator's rule: before you trust any “average,” look at the shape of the distribution. The quickest way is a histogram, which you already know how to build.

checks <= 50.00 cutoff to see what a single whale does to the chart.p95: “top 5%,” not “worst 5%”
You calculated quantiles in the chapter on taking a first look at data. Here, one distinction matters because getting it wrong can derail an entire report.
p95 is the value at or below which roughly 95% of observations fall. About 5% lie beyond that boundary; if values are repeated, the share may differ. The definition says nothing about “bad” or “good.” The top 5% are simply the highest 5%; whether that is desirable depends on the metric:
| Metric | Who are the top 5% (above p95)? | Good or bad? |
|---|---|---|
| Delivery time | orders that took the longest to arrive | bad: these really are the “worst” orders, the ones you apologize for |
| Server response time | the slowest requests | bad: p95 is used in SLAs — service-level promises |
| Order value | the most expensive orders | good: these are the most valuable purchases, and revenue depends on them |
| Number of returns per customer | customers who make returns most often | bad |
The habit of calling p95 the “worst 5%” comes from metrics such as speed and latency, where larger values are worse. With money, that reverses the meaning: a $50.00 order is a good outcome for Kotomarket, not a problem. In our sample, p95 ≈ $22.60, so roughly one order in twenty costs more. p99 marks the boundary for roughly the top 1% of largest orders, where whales may start to appear.
Read a in two steps: first identify which observations fall on either side of the boundary, then decide what those observations mean for the business.
How to choose the right metric for the job
- Revenue calculation and planning — total order value, or average order value together with the number of orders: average order value × number of orders = revenue, assuming there are no missing values.
- Describing an ordinary order — the median and nearby quantiles (p25, p75).
- Promises and thresholds (, “slow to load,” the cutoff for an “expensive cart”) — p90/p95/p99.
- Finding anomalies — the gap between p99 and the maximum: it does not prove something is wrong, but it gives you a reason to inspect the extreme orders directly.
A useful report on Kotomarket order values puts three numbers side by side: the median for an ordinary order, the mean for revenue per order, and p95 for the threshold above which roughly 5% of the most expensive orders remain. A large gap between them is a property of the distribution, not a reporting error. It suggests that expensive orders may contribute a noticeable share of revenue, but you still need to calculate that share separately. Hiding the gap behind a single number hides an important feature of the business.
L., entry #42: “Taught the marketing team the word ‘quantile.’ It lasted two days, then they went back to the mean. The mean is more convenient: ours is bigger.”
In the exercises below, you'll calculate all three metrics yourself, then measure what share of Kotomarket's revenue came from the top 5% of orders in another sample.
checks, pd.Series, $). Calculate the average order value, the median, the 95th percentile, and how many times larger the mean is than the median (gap). Round each result as specified in the variable comments.n_top), and what share of ALL revenue do they generate (top5_share, rounded to 3 decimal places)? 2) Does the mean really preserve the total? Calculate total_from_mean = mean × number of orders (rounded to 0 decimal places) and compare it with the actual sum of the order values.Key takeaways
- Name the unit of observation first: in the order table, each row is an order, not a person. You cannot calculate the “average customer” from an order-level table.
- The mean preserves the total (
mean × count = sum of values) and is therefore sensitive to the tail. The median is a robust measure of a typical observation, so extreme values affect it much less. - A gap between the mean and median is a measurable feature of the distribution's shape, not an error.
- p95 is the threshold above which roughly 5% of observations lie. Because values can be tied, the share of orders with
>= p95may differ from 5%. - Whether high values are good or bad depends on the metric: long delivery times are worse, while large order values are the most expensive orders, though not necessarily the most profitable.
- A useful report on an order-value distribution shows three numbers side by side: the median, the mean, and p95. One number instead of a distribution is an alibi, not a report.
Next: we've learned to inspect the shape of a distribution, but we still cannot measure how spread out the data is or, more importantly, how much OUR ESTIMATE varies. The next lesson covers exactly that.