aNet.ai
Data Science/Learning path
0day streak0XP · Lv 1
← 1. Thinking Like a Data Scientist
Lesson 2.9 6 min · 132 words

Lab 1: what you should be able to explain

The lab joins student information to course registrations, then compares recorded pass rates. Each pass result still belongs to a registration.

The four TODO replacements are students, one_student_table, 'study_mode', and 'programme'. Understand why each belongs there.

one_student_table = students
joined = enrolments.merge(
    one_student_table[['student_id', 'programme', 'study_mode']],
    on='student_id', how='left', validate='many_to_one'
)
pass_rate_by_mode = (
    joined.groupby('study_mode')['passed']
    .agg(n='size', pass_rate='mean')
    .assign(pass_rate=lambda x: 100 * x['pass_rate'])
)

For a complete Boolean/0-1 outcome, its mean equals passes divided by registrations. size counts group rows; count counts nonmissing values. If passed has missing values, the mean excludes them while size includes them: explicitly report the two denominators. The Lab 1 code assumes the provided pass outcomes are complete.

The final reflection must explain why the programme with the highest pass rate is not automatically the best teaching programme: preparation, course selection, grading thresholds and missingness can differ. Your chart is a descriptive comparison of registrations, not an intervention evaluation.

Sources: W1 PDF pp. 3, 13-17, 22-30, 32-53, 57-60; L1 Parts 1-5.

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.

Question 1 of 6 · +5 XP

For complete 0/1 pass outcomes, what is their mean?

Question 2 of 6 · +5 XP

If passed contains missing values, how do size and mean behave?

2. Application

Apply the concept to a case or calculation.

Question 3 of 6 · Binary mean · +5 XP

What is the pass rate for [1,0,1,1]?

Question 4 of 6 · Missing denominator · +5 XP

For [1,0,1,missing], what are size and count?

3. Interpretation and limitations

Evaluate assumptions and justify conclusions.

Question 5 of 6 · Grouping · +5 XP

What does groupby('programme') do before calculating rates?

Question 6 of 6 · Interpretation · +5 XP

Programme A has the highest observed rate. What can be said directly?

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

size counts all entries in the group. count counts nonmissing entries. With four rows and one missing result, size is 4 and count is 3.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Show an example answer

The groups may differ in preparation, course selection, grading thresholds or missing results. A descriptive difference alone does not measure a teaching effect.

Check: did you answer the question, use evidence or working, and avoid claiming more than the evidence supports?

Practice this topic
Saved in this browser as you type.
aNet.ai · Data Science Fundamentals · Weeks 1–5 · practice material, not an official examProgress saved in this browser