Compare programmes carefully
Part 5 · TODO 4
Changing groupby changes the comparison, not its causal strength. Course mix and preparation can still differ between programmes.
Week 1: claim ladder, PDF pp. 22–29; Week 5 course mix, PDF pp. 38–51
Your task
Change the grouping field to programme. Run the summary and use its table or a chart to describe differences.
Evidence to include
Name the groups and their denominators. Give a plausible alternative explanation for the highest rate.
Notebook questions and code
Read here; run in your downloaded notebook. Start with its setup cells and run in order. Use your own ID and outputs where requested.
Download Lab 1 notebookPart 5: Small challenge
You have already seen the full pattern. Now change one word in the code below.
The question is: “How do course-registration pass rates differ by programme?”
- Replace the blank with the correct grouping column.
- Run the cell.
- Make a short chart or use the printed table.
- Explain why the programme with the highest value is not automatically the “best” programme.
Python · cell 21 — read here, run in your notebook
# TODO 4 - Replace the blank with the correct column name.
# Hint: the column describes Biology, Computer Science, Economics, or Psychology.
challenge_table = (
joined.groupby(_____)["passed"]
.agg(n="size", pass_rate="mean")
.assign(pass_rate=lambda x: (100 * x["pass_rate"]).round(1))
.reset_index()
)
challenge_tableSaved only in this browser. This note doesn’t fill in the downloaded notebook; “reviewed” is a personal checklist, not a grade.