Competitive Exam Analysis
Six stages: response validation, key merging, negative marks, subject breakdown, accuracy and rank list
Your project brief
Build a reproducible exam-scoring engine with explicit negative marking and accuracy rules.
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 candidate responses
Merge candidate details, standardise choices and prevent double answers.
input/responses.csv→output/stage01.csvStage 02 — Merge answer key
Check every question and join subject, correct answer and scoring rules.
output/stage01.csv→output/stage02.csvStage 03 — Score responses
Give +marks for correct answers, −penalty for wrong, and zero for skipped.
output/stage02.csv→output/stage03.csvStage 04 — Analyse subjects
Summarise each candidate's correct, wrong, skipped and awarded marks by subject.
output/stage03.csv→output/stage04.csvStage 05 — Aggregate candidates
Combine subject totals to overall score, attempted accuracy and final rank.
output/stage04.csv→output/stage05.csvStage 06 — Publish merit list
Sort by rank, generate the final candidate 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/exam-analysis
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: Try duplicate answers, unknown questions and invalid choices. Ensure unanswered questions score zero.
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.