Student Examination Results
Six stages: registration, marks, pass/fail, grading, city comparison and final reports
Your project brief
Build a school results register where missing marks are never quietly replaced with zero.
Your task is to run each stage separately, explain the columns it creates, inspect the output CSV, and verify that the following stage consumes that exact file. A complete worked solution is provided alongside the exercises.
Six-stage processing sequence
Stage 01 — Validate registration
Clean names and check student IDs; output a trusted registration table.
input/students.csv→output/stage01.csvStage 02 — Join subject marks
Merge marks from marks.csv, match IDs and verify marks lie between 0 and 100.
output/stage01.csv→output/stage02.csvStage 03 — Calculate scores
Compute totals and percentages; treat missing subject marks as incomplete.
output/stage02.csv→output/stage03.csvStage 04 — Grade and rank
Apply an explicit grading scale, then rank recorded totals.
output/stage03.csv→output/stage04.csvStage 05 — City performance
Add city averages and within-city ranks without losing student records.
output/stage04.csv→output/stage05.csvStage 06 — Publish report
Sort by total marks and export a consolidated report.csv.
output/stage05.csv→output/report.csv
See what each stage reads and writes
Choose a stage. The table on the left shows the real source CSV; the table on the right shows the committed output CSV snapshot. Run the Python scripts locally to recreate these files.
Choose a stage to inspect the CSV data.
Input CSV
Open input CSVOutput CSV
Open output CSVCSV snapshots are read-only and are hosted with the lesson. The browser does not execute Python or edit repository data. Inspecting a file is separate from running the local pipeline.
Sample inputs and expected results
Every file is real, readable CSV. Open these files directly or use the browser's save function; no account is required.
python -m pip install pandas
cd python/pandas/projects/csv-pipelines/student-results
python run_pipeline.py
python -m unittest discover -s . -p "test_*.py"Learn from each step instead of running everything blindly. The output CSV from one stage should become the next script's input.
Student exercises and assessment
- Run all six stages one by one and explain each CSV transformation.
- Identify two new columns added between Stage 2 and Stage 4.
- Modify a copy of the first input file and predict how the final report will change.
- Create a log recording each stage's input rows, output rows and filename.
- Extend one stage to detect errors and write a
rejected.csvfile, without silently dropping incorrect records. - Challenge: Inject a duplicated StudentID, an unknown marks ID and a score of 150. Each should cause a clear failure.
Open solution guidance
Study pipeline.py for the complete implementation. Use report.csv as a final comparison and run the test suite to verify important rules.
What happens after this project?
Repeat it with your own non-sensitive sample data. For the next challenge, keep invalid rows in a separate error file, add transaction dates, schedule recurring processing and compare runs over time.
Reference lessons: Data cleaning · Sorting and GroupBy · CSV read/write · Merge/concat.