What number did the AI divide by to get your percentage?
Find the number on the bottom of a satisfaction percentage and recompute the two that come out of the same survey.
Free course. Your Maestro, an AI, .
The second question is what did it divide by? Every percentage is a division: something you count on top, divided by something you count on the bottom. The one on the bottom is called the denominator, and it almost never appears in the sentence the AI gives you.
Imagine you hand your assistant the hardware store's March satisfaction survey and ask "what percentage of our customers are satisfied?" Imagine it answers:
88.9% of customers are satisfied (rating of 4 or 5).
One survey was sent for each of the 112 paid tickets. There were 45 responses; 40 rated 4 or 5. That is 88.9% of responses and 35.7% of surveys sent. We do not know how many unique people they represent: a person may have purchased more than once.
The top bar and the bottom bar have the same number of ratings of 4 or 5. The only thing that changes is the base:
Both numbers are correct. They answer different questions:
- 88.9%: of the responses received, how many rated 4 or 5?
- 35.7%: of the surveys sent, how many received a rating of 4 or 5?
The problem appears when the sentence says "of customers" and doesn't say which ones. Anyone who reads "89% of customers are satisfied" will understand that almost all customers are, and the survey knows nothing about the 67 unanswered surveys. So which of the two do I put in my report?
Three questions for any percentage
- Whose is it? All customers, those who answered, registered customers, paid tickets? That is the base.
- What was counted on top? Here "satisfied" is 4 or 5. If it were only 5, it would be 26 out of 45, 57.8%. Someone chose the definition; ask the AI to state it.
- Who dropped out of the bottom? Empty cells, people who didn't answer, rows a filter removed. What leaves the denominator changes the result without showing in the sentence.
The habit you take from this page is short: every percentage goes with its "out of how many." Not "89% satisfaction," but "40 of the 45 responses (89%)."
How each one is calculated
These lines use the calificacion column, which is empty when the person didn't answer:
contestaron = data["calificacion"].notna().sum() # how many cells have a ratingsatisfechos = (data["calificacion"] >= 4).sum() # how many ratings are 4 or 5encuestados = len(data) # how many were sent the surveyStart of lines 4–5. satisfechos / contestaron # proportion among those who answeredsatisfechos / encuestados # proportion among everyone End of lines 4–5.Two new pieces:
notna()asks "does this cell have anything in it?" for each row, and.sum()counts how many times the answer was yes.(data["calificacion"] >= 4)asks "is it 4 or more?" for each row. Again,.sum()counts the yeses. An empty cell answers no.
A proportion like 0.889 is the same as 88.9%: you multiply by 100.
Try it
The exercise uses the March survey. It already counts who answered and who was satisfied. Complete the two divisions and compare them with the AI's 88.9%. Then change the definition of satisfied to "only 5" and see what happens. I don't know what the right denominator is for my case.
Your turn
Calculate the percentage of ratings of 4 or 5 with the two bases: among responses received and among surveys sent. You are done when the output shows 88.9 and 35.7. For the second part, change >= 4 to == 5 and run it again: what does each percentage become?
Data: encuesta-marzo, 112 rows
| Row | Remove | |||||
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | ||||||
| 3 | ||||||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 | ||||||
| 8 | ||||||
| 9 | ||||||
| 10 | ||||||
| 11 | ||||||
| 12 | ||||||
| 13 | ||||||
| 14 | ||||||
| 15 | ||||||
| 16 | ||||||
| 17 | ||||||
| 18 | ||||||
| 19 | ||||||
| 20 |
Enter saves; Esc undoes; empty is a missing value
Tab indents; Esc then Tab leaves
With == 5 you should get 57.8% among those who answered and 23.2% among everyone. Four different numbers for "how satisfied are our customers?", all correctly calculated. That is why the number alone is not enough: what you need is the number with its base and its definition.
Check yourself: With the same survey, the AI tells you "89% satisfaction" and a report from your coworker says "36% satisfaction." What is most likely?