Skip to content
Start free

Is the average salary what most people earn?

Work out the mean and the median of La Ceiba's salaries and see what happens to each when one very high salary joins the list.

Free course. Your Maestro, an AI, .

Human Resources at La Ceiba is writing a job ad and wants a number that sounds good: "The average salary at La Ceiba is 20,978 pesos a month." The math is right: add up the salaries of the company's 40 people (synthetic data) and divide by 40.

Before you see the salaries, think about what that number tells you about the people who work there.

Check yourself: 40 people work at La Ceiba and the average salary is 20,978 pesos. How many of the 40 earn less than that?

Two ways to say "typical"

The average (or mean) adds everything up and splits it into equal parts: it is what each person would earn if the payroll were divided evenly. The median puts the values in order from lowest to highest and takes the one in the middle: half earn that or less, and the other half earn that or more.

When the values are close together, the two numbers nearly match. When a few sit far from the rest, they pull apart. Try it on a short list before you see all 40 salaries. The program uses statistics, a tool that comes with Python: mean is the average and median is the median. (The code keeps its Spanish names and comments.)

Five monthly salaries at a store, in pesos (invented numbers).

Five monthly salaries at a store, in pesos (invented numbers).

Five similar salaries

Example 1 of 2

cinco_sueldos.py
import statistics

sueldos = [9000, 10000, 10500, 11000, 12000]
print(round(statistics.mean(sueldos)))
print(round(statistics.median(sueldos)))

A guess is fine: it's kept as you wrote it, so you can compare. Only you and your Maestro see your predictions.

Example 2 of 2, opens once you explain this one

Make your prediction

That is the whole secret. The average uses how much each salary is worth, so one huge salary weighs a lot. The median only uses the order, so it makes no difference to the median whether the 215,000 salary is 215,000 or 15,000: it is still "the one at the top."

Now look at the 40 salaries at La Ceiba. Each tick mark is one person:

Synthetic course data: 40 people at Tiendas La Ceiba.

The median falls in the middle of the bunch, where the people are. The average falls in a gap: nobody at La Ceiba earns around 21,000 pesos. The cashiers and stock clerks, who are the majority, earn around 10,000. The ad that says "average salary of 20,978" is true and, for someone looking for a cashier job, misleading.

This happens with almost anything that has a floor but no ceiling: salaries, sales per store, wait times, house prices, social media followers. Nobody earns less than zero, but someone can earn ten times more than everyone else. That long "tail" toward the high values pulls the average up.

If your work reports an average of something like this (salaries, tickets, wait times), ask your Maestro what would change with the median.

Try it

Calculate both numbers yourself with the 40 salaries. The code below uses : data is the salary table and sueldos is its monthly salary column. It already computes the average. Add two lines: the median, with sueldos.median(), and how many people earn less than the average, with (sueldos < promedio).sum(). Show each with print, like the one for the average.

If you don't see how (sueldos < promedio).sum() counts people, ask your Maestro.

Add the median and how many people earn less than the average, and show all three lines. You are done when you see Promedio: 20,978, Mediana: 10,450 and that 34 of 40 people earn less than the average. (The labels in the output stay in Spanish, like the code.)

Add the median and how many people earn less than the average, and show all three lines. You are done when you see Promedio: 20,978, Mediana: 10,450 and that 34 of 40 people earn less than the average. (The labels in the output stay in Spanish, like the code.)

Run your code to see what it prints and the value of its last expression. Every run starts fresh.

Ready to run your code.

Run your code to see its output here.

Data: salarios, 40 rows

Enter saves a cell and Escape leaves it as it was. Leave a cell empty for a missing value.

The exercise's data, "salarios". Your edits run with your code.
RowRemove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Page 1 of 2

Run it yourself

So the average is useless?

It is useful, for a different question. The average times the number of people gives the total: 20,977.5 × 40 = 839,100 pesos of payroll a month. If Finance needs to budget the payroll, the median is no use at all: 10,450 × 40 would give 418,000, less than half of what is actually paid.

The question that decides it is: do you care about the total, or the typical person?

  • For budgets, total costs and "how much do we spend on this," use the average.
  • For "how much does someone who works here earn," "how much does a normal store sell" or "how long does a customer wait," use the median.
  • If the two are far apart, give both: that distance is information. It tells you a few values are very large.

Check yourself: Finance at La Ceiba needs to know how much next month's payroll will cost for all 40 people, if nobody's salary changes. Which calculation does it use?