Session 5 Exercise — Merging Three Sources
Optional enrichment — complete during the session if time allows, or finish independently on your fork.
Your Task
- Load
exercises/data/outreach_contacts.csv - Load
exercises/data/school_survey_2019.csv - Load
exercises/data/middle_schools_2019.csv - Merge contacts with survey on
student_id(left join) — keep onlystudent_idandncesschfrom the survey - Normalize
ncesschto a clean string in both DataFrames - Merge the result with middle schools on
ncessch(left join) - Print how many contacts have no school match (
school_nameis NaN) - Print the first and last names of those unmatched contacts
- Save the merged result to
exercises/data/merged_contacts.csv(no index)
Starter Script
Open session_05_exercise.py and fill in the blanks marked with # TODO:. If you get stuck, the completed version is at session_05_answer.py.
Run from the repo root:
python exercises/session_05_exercise.py