Student Performance Prediction · Phase 2 · Lesson 1 of 3
Cleaning the Student Dataset
Find and fix missing values, impossible values and inconsistent categories in the synthetic student data, recording each decision in a cleaning log.
What you need
A computer with a web browser and a free Google account for Google Colab, or Python with Jupyter installed locally. Libraries: pandas, scikit-learn and matplotlib (all free).
In this lesson you will
- Detect and handle missing and impossible values
- Record cleaning decisions reproducibly in code
Key concepts
missing valueimputationoutliercategory cleaningreproducibility
The lesson
Check every column: missing attendance, test scores above 100, schools spelled two ways. Count problems before fixing them, so the cleaning log can report what changed.
Handle missing values deliberately: for a few missing test scores, fill with the student's other-term average or the class median and add a flag column; never silently drop many rows, which can remove whole groups of students.
Do all cleaning in code cells, never by editing the CSV by hand, so the whole process can be re-run and checked.
Step by step
- Count missing and impossible values per column.
- Standardise category spellings.
- Impute or flag missing values with a recorded rule.
- Re-run the notebook from the top and check the counts.
Practice activity
Clean the dataset in code and produce a cleaning log with counts before and after each step.
Expected result: A clean DataFrame created entirely by code and a cleaning log that explains each step.
Common mistakes
- Dropping every row with any missing value
- Editing the data file by hand
Check your understanding
-
Why add a flag column when you fill a missing value?
Show answer
So the model and the analyst know the value was estimated.
-
Why clean in code rather than by hand?
Show answer
So the process is reproducible and can be checked.
Further learning
Projects are instructor-guided: an instructor sets milestones, checks your work and gives feedback, online or in person. Self-study of the public lessons does not lead to a certificate. Enrolment and fees follow the Academy's existing policies — contact the Academy.