A compact EDA implementation pattern
A short summary table should make the row count, known outcomes and missing outcomes visible. It should not disguise unknown rates as zero.
This pattern assumes the course CSVs have been loaded and passed is a Boolean/0-1 outcome. The CSV files were not attached, so use it as a code-reading template rather than as a claim about an executed dataset here.
joined = enrolments.merge(
students[['student_id', 'study_mode']],
on='student_id', how='left', validate='many_to_one'
)
assert len(joined) == len(enrolments)
def rates(group_columns):
out = joined.groupby(group_columns)['passed'].agg(
registrations='size', known='count', passes='sum'
)
out['missing'] = out['registrations'] - out['known']
denom = out['known'].where(out['known'].gt(0))
out['known_pass_rate'] = out['passes'] / denom
return out
pooled = rates(['study_mode'])
within_course = rates(['course_code', 'study_mode'])
An all-missing group has no known-outcome rate; do not call its zero observed successes a 0% pass rate. Inspect matching and missing group labels as well. If evaluating predictions for new students, keep each student's registrations in one split.
Lab 5's lecture handoff asks for an explicit question and population, checked join keys and missing n, pooled versus within-course rates, and an observation, explanation and limitation. No separate Lab 5 notebook was attached.
Source: W5 PDF pp. 3-51, 53. The lecture uses both a constructed 200-student support example and a synthetic 4,665-registration course dataset. They are different tables with different units.
Practice problems
Supplementary study questions on the lecture concepts — not verbatim exam questions. Each answer counts toward spaced review.
1. Conceptual understanding
Definitions and distinctions.
A group has no known pass outcomes. What is its known pass rate?
Which grouped outputs make missing outcomes visible?
2. Application
Apply the concept to a case or calculation.
A group has size 12 and known count 9. How many outcomes are missing?
A group has 6 recorded passes among 9 known outcomes and 12 rows. What is its known-outcome rate?
3. Interpretation and limitations
Evaluate assumptions and justify conclusions.
Why inspect missing study_mode values before grouping?
There are 10 rows and 0 known outcomes in a group. What should its known pass rate be?
Explain it in writing
Self-checked, not marked. Write a few sentences, then compare with the example answer. Your writing is saved as you type.
Show an example answer
There are no recorded outcomes to support a pass-rate estimate. Calling it 0% would falsely claim observed failure rather than lack of knowledge.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?
Show an example answer
Check key uniqueness, expected join size, unmatched IDs, missing group labels and known/missing outcomes. Then compare pooled and within-course rates with their counts.
Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?