Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Explorations › Data detective › lesson 2 of 6

Clean the mess

Real data has blanks, typos and impossible values. Find them, decide what to do, and see how much the answer changes.

Data scientists joke that 80% of the job is cleaning. A single typo can wreck an average, so cleaning comes before any conclusion.

Spot the problems

Turn the model and find the yellow balls:

  • Student 24 scored 999. The test is out of 100, so this is a typo, perhaps for 99.
  • Student 32 studied −3 hours. Impossible.
  • Students 6, 18 and 37 have a blank: a score, an hours value or a sleep value is missing.

Press Remove the broken rows and watch the mean score: it drops from over 75 to about 53. One typo had dragged it up by more than 20 marks.

Check every value with code

What to do with a broken row

choicewhen it makes sense
remove the rowfew broken rows, no pattern in which ones
fix ityou can check the original, such as the marked paper
fill the gapmany gaps; fill with the median, and say so

Whatever you choose, write it down. Anyone checking your work should be able to repeat it.

What to remember

  • Look for blanks, typos and values that cannot be true.
  • One bad value can move an average a long way.
  • Remove, fix or fill broken rows, and record what you did.
  • Check rules in code, such as "a score is between 0 and 100".
Load a real datasetNext