Year 9 › Data Science and AI › Lesson 2 of 5
Year 9 · Spring 1 · Data Science and AI Cleaning: missing values and outliers
Topic 18 Data, spreadsheets and AI
KS3 Computing · Data is raw facts. Information is data with meaning. Spreadsheets calculate, databases store and search, and AI learns patterns from examples.
Managing Data Cambridge Lower Secondary Computing 0860
You will learn to Identify missing values, wrong formats, impossible values, spelling differences and duplicates in a dataset. Use COUNTBLANK, sorting and filters to find problems quickly. Decide for each problem whether to fix it, blank it or keep it, and give a reason. Record every change in a cleaning log: the cell, what it was, what it is now, and why.
Success criteria I can find all the planted errors in the class sheet. I can explain why '7h' cannot be averaged but 7 can. I can show a cleaning log with a reason for every change.
Formula A spreadsheet calculation. Always starts with =.
Function A subroutine that returns a value.
Record / field One row in a database table: everything stored about one thing.
Primary key A field whose value is unique for every record.
SQL Structured Query Language: asks databases questions.
Machine learning The computer finds rules itself from labelled examples.
Why data needs cleaning Dirty data is data with mistakes or gaps. Real survey data is almost always dirty.
People skip questions, make typos, or type answers in their own way. One bad value can wreck a whole answer.
One wrong value, 300, made the mean more than eight times too big.
★ RememberCleaning means finding the problems and deciding what to do with each one. You clean before you analyse.
Five common problems An outlier is a value far away from the rest. Check every outlier, but do not assume it is wrong.
e.g. Example11 hours of sleep is unusual, but possible. Keep it. 300 hours is impossible. It cannot stay.
Find, then decide Spreadsheet tools find problems fast. Here the sleep data is in B2 to B31.
Then decide what to do with each problem:
Fix it when you know the true value: '7h' becomes 7.Blank it when it is impossible and you cannot check: 300 becomes a blank.Keep it when it is unusual but possible: 11 hours stays.Delete the row only when it is a true duplicate.! Watch outNever delete a value just because you do not like it. That changes the answer. It is not cleaning.
Log every change Keep a cleaning log on a separate tab called 'cleaning'. It lists every change you made.
? Why?Why keep a log?
Anyone can check your choices, or undo one. Honest data science always says what was changed, and why.
e.g. Worked exampleThe sleep column holds: 8, (blank), 7h, 9, 300, 7.5. Clean it, then find the mean.
The blank: we cannot know the answer, so leave it blank. AVERAGE skips blank cells. '7h' is text. The person clearly meant 7, so change it to 7 and log it. 300 is impossible in one night. Blank it and log it. The clean values are 8, 7, 9 and 7.5. That is 4 values. Mean = (8 + 7 + 9 + 7.5) ÷ 4 = 31.5 ÷ 4 = 7.875. That is about 7.9 hours. Before cleaning, AVERAGE skips '7h' and the blank, and gives 324.5 ÷ 4 ≈ 81 hours. Cleaning matters.
The steps for this lesson
Mark this lesson as done Saved on this device.
← Previous lesson Asking questions and collecting data Next lesson → Analysing in a spreadsheet or Python