Pandas 0 to Infinity · Intermediate project

Student Examination Results

Six stages: registration, marks, pass/fail, grading, city comparison and final reports

Intermediate · merges, validation, aggregate, rank · 6 executable CSV stages

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

  1. Stage 01 — Validate registration

    Clean names and check student IDs; output a trusted registration table.

    input/students.csv → output/stage01.csv

    Run stage 01.py · Processing function · Inspect output CSV

  2. Stage 02 — Join subject marks

    Merge marks from marks.csv, match IDs and verify marks lie between 0 and 100.

    output/stage01.csv → output/stage02.csv

    Run stage 02.py · Processing function · Inspect output CSV

  3. Stage 03 — Calculate scores

    Compute totals and percentages; treat missing subject marks as incomplete.

    output/stage02.csv → output/stage03.csv

    Run stage 03.py · Processing function · Inspect output CSV

  4. Stage 04 — Grade and rank

    Apply an explicit grading scale, then rank recorded totals.

    output/stage03.csv → output/stage04.csv

    Run stage 04.py · Processing function · Inspect output CSV

  5. Stage 05 — City performance

    Add city averages and within-city ranks without losing student records.

    output/stage04.csv → output/stage05.csv

    Run stage 05.py · Processing function · Inspect output CSV

  6. Stage 06 — Publish report

    Sort by total marks and export a consolidated report.csv.

    output/stage05.csv → output/report.csv

    Run stage 06.py · Processing function · Inspect output CSV

Interactive CSV Pipeline Inspector

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 CSV
Loading input…

Output CSV

Open output CSV
Loading output…

CSV 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.

Terminal · complete run
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

  1. Run all six stages one by one and explain each CSV transformation.
  2. Identify two new columns added between Stage 2 and Stage 4.
  3. Modify a copy of the first input file and predict how the final report will change.
  4. Create a log recording each stage's input rows, output rows and filename.
  5. Extend one stage to detect errors and write a rejected.csv file, without silently dropping incorrect records.
  6. 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.

← All CSV projectsExplore another project →