Lesson 1 · Module 1: Data Foundations with Pandas
Why statistics matters for everyday decisions: from gut feel to numbers
Video coming soon
Learn it with your tutor on the live board
Key points from the video
The Monday meeting
- A new checkout page was tested against the old one
- Version A: 48 orders, version B: 30 orders
- "Roll out A," says the room
- Is that the right call?
What you will learn
- Why gut feel and raw totals mislead
- How to turn counts into fair comparisons
- Three questions to ask of any number
Gut feel versus numbers
- Gut feel: fast, based on memorable cases
- Numbers: slower, based on all the cases
- Statistics: the rules for reading numbers fairly
The decision loop
- Start with a question, not a spreadsheet
- Summarise, decide, then check what happened
Worked example: rates, not totals
- Version A: 1,200 visitors, 48 orders
- Version B: 600 visitors, 30 orders
- Which page converts better?
48/1200 = 0.04 | A: orders divided by visitors
0.04 = 4/100 = 4% | four over one hundred, four percent
30/600 = 0.05 | B: orders divided by visitors
0.05 = 5/100 = 5% | five over one hundred, five percent || box:5%
# B converts better: 5% against 4% Worked example: the typical ticket
- Five support tickets: 5, 6, 7, 8 and 64 minutes
- What is a typical handling time?
5 + 6 + 7 + 8 + 64 = 90 | add the five times
mean = 90/5 = 18 | divide by five, the mean is eighteen minutes
# Sorted: 5, 6, 7, 8, 64. The middle one is 7.
median = 7 | the median is seven minutes || box:7 Small samples bounce around
- The true rate here is 5%
- Few visitors: the measured rate jumps
- Many visitors: it settles down
layout: side
kind: coin
seed: 11
p: 0.05
steps:
- at: "just twenty visitors"
run: 20
note: "20 visitors"
- at: "two hundred visitors it's closer"
run: 200
note: "200 visitors"
- at: "five thousand visitors"
run: 5000
over: 4
note: "5,000 visitors"
- at: "hugs the true line"
note: "More data, steadier rate" The same check in pandas
- pandas: a Python library for tables
- A DataFrame is a spreadsheet in code
import pandas as pd
ab = pd.DataFrame({
"version": ["A", "B"],
"visitors": [1200, 600],
"orders": [48, 30],
})
ab["rate"] = ab["orders"] / ab["visitors"]
print(ab) Three questions for any number
- Out of how many? (count behind it)
- Compared with what? (rate, baseline)
- How much does it vary? (spread, sample size)
Common mistake: comparing totals
- Totals reward whoever got more traffic
- Averages hide one extreme case
- Small tests produce lucky winners
Recap
- Rates, not totals, for fair comparisons
- Median shows the typical case when outliers exist
- Ask: how many, compared with what, how much variation
Your exercise
- Find one number from your work this week
- Ask the three questions about it
- Rewrite it as a rate or a median
Transcript
The Monday meeting. Picture a Monday meeting at an online shop. Last week the team tested two checkout pages. Version A brought in forty-eight orders and version B brought in thirty. Someone says, roll out A, it's obviously better, and everyone nods. It sounds reasonable. But nobody asked how many people saw each page. What if A simply got twice as many visitors? Decisions like this happen every day, about discounts, surveys, support staffing and ad spend, and most of them are made on gut feel plus one number. This course is about making those calls with a little more care, using tools you already know.
What you will learn. In this lesson you'll learn three things. First, why gut feel and raw totals often point you the wrong way, even when the numbers themselves are correct. Second, how to turn counts into fair comparisons, using rates and typical values instead of totals. Third, a short checklist of three questions you can ask about any number someone puts on a slide. There's very little maths here, just division and sorting, and we'll write every step out. By the end you'll be able to challenge that Monday meeting politely and with evidence.
Gut feel versus numbers. Gut feel isn't useless. It's fast, and it's built from experience. The problem is that it's built from the cases you remember, like the angry customer email or the one huge order, not from all the cases. Numbers look at everything, but they can mislead too if you read them carelessly. That's where statistics comes in. In plain words, statistics is a set of rules for summarising data and judging how much to trust the summary. Think of it like reading a map: the map is accurate, but you still need to know which way is north.
The decision loop. Here's the loop we'll use through the whole course. You start with a business question, such as which checkout page sells better. Notice that the spreadsheet comes second. Starting from the question keeps you from drowning in columns that don't matter. Then you collect the data that answers it, here visitors and orders for each version. Next you summarise fairly, which is the part this lesson is about. Then you decide, and finally you check the result after the change goes live. That check feeds your next question.
Worked example: rates, not totals. Let's fix the Monday meeting. Version A had twelve hundred visitors and forty-eight orders. Version B had six hundred visitors and thirty orders. A conversion rate is the share of visitors who buy. For A: orders divided by visitors, forty-eight over twelve hundred, is zero point zero four. Zero point zero four is four over one hundred, so A converts four percent. For B: orders divided by visitors, thirty over six hundred, is zero point zero five. Zero point zero five is five over one hundred, so B converts five percent. So B converts better: five percent against four percent. A only had more traffic.
Worked example: the typical ticket. Now a support team example. Five tickets took five, six, seven, eight and sixty-four minutes. The mean, or average, is the total divided by the count. Add the five times: five plus six plus seven plus eight plus sixty-four is ninety. Divide by five, the mean is eighteen minutes. But does a typical ticket really take eighteen minutes? Sorted, the times are five, six, seven, eight, sixty-four, and the middle one is seven. That middle value is called the median. So the median is seven minutes, much closer to what most customers experience.
Small samples bounce around. Here's a simulation of a page whose true conversion rate is exactly five percent. Each flip is one visitor, and the coin is lopsided: it lands heads only five times in a hundred, and a head means they bought. With just twenty visitors the measured rate can be zero, or ten percent, purely by luck. By two hundred visitors it's closer, but still wobbly. After five thousand visitors the rate hugs the true line. This is why a result from a tiny test isn't a result yet. The same page can look like a winner or a loser depending on who happened to visit.
The same check in pandas. You can do all of this in Excel, and that's fine. In this course we'll also use pandas, a free Python library for working with tables. Its main object is the DataFrame, which you can think of as a spreadsheet you control with code. Here we build a tiny table with the two versions, their visitors and their orders. Then one line adds a rate column, orders divided by visitors, just like a formula filled down in Excel. The output shows zero point zero four for A and zero point zero five for B, the same four and five percent as our board.
Three questions for any number. Here's the checklist to carry into every meeting. First, out of how many? Forty-eight orders means little until you know it was out of twelve hundred visitors. Second, compared with what? A survey saying seventy percent of customers are satisfied needs a baseline, like last quarter's score. Third, how much does it vary? A rate from twenty visitors, or an average dragged up by one slow ticket, deserves less trust. You don't need formulas to ask these questions, and asking them already puts you ahead of most slide decks.
Common mistake: comparing totals. The most common mistake is comparing totals when the groups are different sizes. More orders, more complaints, more signups: all of these grow with traffic, so the bigger group usually wins on totals even when it performs worse. Close cousins of this mistake are trusting an average that one extreme value has pulled up, and declaring a winner after a test with a handful of visitors. The fix is the same each time. Divide by the size of the group, look at the median next to the mean, and check how many cases sit behind the number.
Recap. Let's recap. First, compare rates, not totals: version B converted five percent against four percent for A, even though A had more orders. Second, when one extreme value is present, the median shows the typical case better than the mean, as the support tickets showed with seven minutes versus eighteen. Third, before trusting any number, ask out of how many, compared with what, and how much it varies. These three habits turn gut feel into a decision you can explain and defend.
Your exercise. Before the next lesson, find one number that someone used to make a decision at work this week. It might be total sales by region, the average rating from a survey, or the number of tickets handled. Ask the three questions: out of how many, compared with what, and how much does it vary. Then rewrite the number as a rate or a median if that's fairer, and note whether the conclusion changes. Keep it handy, because next time we'll load real order and survey data into pandas.
Explore the animation
The animations from the video, exact and live: play them, pause, drag the slider or jump to a step at your own pace.
Loading the animation...
Lesson summary
- Video watched
- Rates, not totals, for fair comparisons
- Median shows the typical case when outliers exist
- Ask: how many, compared with what, how much variation