Statistics · Week 1 of 4 · 4–5 hours
Descriptive Statistics: Mean, Median and Mode
Summarize a set of numbers with a single typical value, and know which one to trust.
Learning objectives
By the end of this week you will be able to:
- Explain what descriptive statistics are.
- Calculate the mean, median and mode by hand and in Excel.
- Explain how outliers and skew affect the mean.
- Choose the right measure of center for a situation.
Lessons
Descriptive Statistics
Descriptive statistics summarize data you already have. Instead of reading 10,000 sales one by one, you describe them with a few numbers: a typical value (the center), how much they vary (the spread) and what their pattern looks like (the shape).
They are different from inferential statistics, which use a sample to make guesses about a bigger group (for example, surveying 500 customers to estimate what all customers think). As a beginner analyst, most of your daily work is descriptive.
Two vocabulary words: a population is everyone or everything you care about; a sample is the part you actually measured.
Mean
The mean is the ordinary average: add up all values and divide by how many there are.
Example, delivery times in days: 2, 3, 3, 4, 8. Sum = 20, count = 5, mean = 4.
Excel: =AVERAGE(A2:A6). pandas: df["days"].mean()
Weakness: the mean is pulled by extreme values. If the last delivery took 28 days instead of 8, the mean jumps to 8 even though most deliveries took 2 to 4 days.
Median
The median is the middle value when the data is sorted.
- Odd count: 2, 3, 3, 4, 8 → median = 3.
- Even count: 2, 3, 3, 4, 8, 9 → median = average of the two middle values = 3.5.
Excel: =MEDIAN(A2:A6). The median barely moves when an extreme value appears (with 28 instead of 8, it is still 3). That is why house prices and salaries are usually reported as medians: a few very large values would make the mean misleading.
Mode
The mode is the value that appears most often. In 2, 3, 3, 4, 8 the mode is 3. A dataset can have no mode, one mode, or several.
The mode is the only measure of center that works for categories: the most common shirt size, the most popular product, the region with the most orders. Excel: =MODE.SNGL(A2:A6); for text, use a PivotTable count or COUNTIF.
Choosing the measure:
| Situation | Best measure |
|---|---|
| Numbers roughly symmetric, no extreme values | Mean |
| Skewed numbers or outliers (incomes, prices, wait times) | Median |
| Categories (colors, products, regions) | Mode |
A quick clue: if the mean is much larger than the median, a few big values are pulling it up (the data is right-skewed).
Watch
- VideoStatistics - A Full University Course on Data Science Basics (freeCodeCamp)
Watch the opening chapters on descriptive statistics and measures of center.
Practice
Here are 15 order values: 23, 45, 31, 27, 45, 52, 38, 29, 45, 33, 41, 36, 250, 30, 39.
- Calculate the mean, median and mode by hand, then check in Excel.
- Remove the 250 and recalculate. Which measure changed most?
- Write two sentences recommending which number a manager should use as the "typical order" and why.
Check your understanding
Try each question first, then open it to see the answer.
What is the median of 7, 1, 9, 4?
Sorted: 1, 4, 7, 9. Median = (4 + 7) / 2 = 5.5.
Which measure would you use for the most common payment method?
The mode, because payment method is a category.
The mean salary is $95,000 and the median is $60,000. What does that suggest?
A few very high salaries are pulling the mean up; the data is right-skewed, so the median is more typical.
Assignment
Submit your spreadsheet and written recommendation from the practice task.