Median

noun

say it: “MEE-dee-un” /ˈmidiən/

The middle number in a list sorted from smallest to largest; half the numbers are below it and half above.

What is the median?

The median is the middle value when the values are sorted: half are at or below it and half at or above. One very large or very small value can't pull it far the way it pulls the mean, so it's a fair "typical" value for prices, ages and order totals. With an even count, it's halfway between the two middle values.

import pandas as pd
totals = pd.Series([6, 8, 9, 11, 95])
print(totals.mean())      # 25.8: pulled up by the one 95
print(totals.median())    # 9.0: the middle value

In a sentence

  • “She filled each missing age with its species' median.”
  • “The median order was $9, though one $95 catering order raised the average.”

Level: Novice · More Python terms at this level

Updated