Skip to course content
Free data visualization course

Data Visualization and Dashboard Storytelling

Unit 06.00: Averages that describe nobody

Three groups can share a mean and have nothing else in common.

The mean describes nobody

Three groups with identical means and completely different shapes.

The code reports mean, median, range and spread for each.

import numpy as np

a = np.array([50] * 20)
b = np.array([10] * 10 + [90] * 10)
c = np.concatenate([np.full(19, 47), [107]])

print(f"{'group':>6} {'mean':>7} {'median':>8} {'min':>6} {'max':>6} {'std':>7}")
for name, data in [("A", a), ("B", b), ("C", c)]:
    print(f"{name:>6} {data.mean():>7.1f} {np.median(data):>8.1f} "
          f"{data.min():>6} {data.max():>6} {data.std():>7.1f}")

print("""
Three groups, the same mean, and nothing else in common. In A every member is
average. In B nobody is. In C one outlier carries the mean above nineteen
identical values.

A bar chart of means shows three identical bars.
""")

In the first group every member is at the mean. In the second, nobody is - it is two clusters at 10 and 90. In the third, nineteen identical values sit below the mean and one outlier pulls it up.

A bar chart of means shows three identical bars. Every difference that matters is invisible.

The mistake this prevents

The mistake is charting means because they are what the aggregation produced. Look at the distribution first - if it is bimodal or has outliers, the mean is a summary of something that does not exist.

Takeaway

Check the distribution before charting a mean. Identical means routinely describe completely different populations, and a bar chart cannot show the difference.