Module 5 · Clean It or It Lies

What happens to everything built on top of a dirty table?

Lesson 5.4 · Garbage In, Garbage Out

Ashley · Felix

Every chart from last week: wrong. Every one of them looked fine.

Ashley cleans the export.

Same channel, same sixteen videos, and every chart she made last week is now different. The average dropped by a hundred million.

The “best game” flipped. The pivot has two rows instead of four. Nothing downstream survived.

The short answer

It’s all wrong, and it all looks fine. Ashley’s average, her best game and her video count all changed when the table did. The pitch she almost sent would have quoted a hundred million average views to a store owner who could count.

Try it yourself

Step between the dirty export and the clean one, and watch what happens to the numbers built on it.

Average views (thousands)
100000
Games on the channel
4
Videos counted
10
Average minutes
0

Before cleaning. These are the numbers Ashley nearly put in a pitch to a sponsor.

Step 1 of 2

What you just did has a name

Garbage in, garbage out

The oldest rule in computing: a system can’t produce a good answer from bad input.

Charts, averages and machine learning models all inherit the mess in the table they started from, and none of them can tell you it happened.

A few more things

Cleaning is most of the job

Ask anyone who works with data what they spend their time on. It’s this. Not models, not charts. Fixing spellings, chasing blanks, finding the billion. The glamorous parts sit on top of it.

It happens to big organizations too

In 2020, a UK health agency lost track of nearly 16,000 COVID test results for a week because the file format it was using ran out of rows and silently dropped the rest. Nothing errored. The table just ended early.

Models learn the mess too

Feed a model a table where one game is spelled three ways and it learns three games. Feed it a billion-view row and it learns that billions happen. Modules 18 and 19 are about what a model does with what it’s given.

Go deeper

The longer version, if you want it.

A cleaning checklist

Before any chart: check each column’s type (are the numbers actually numbers?), look at the smallest and largest value in every numeric column (the billion shows up instantly), count the distinct values in every category column (four games when you expected two), count blanks per column, and check for duplicate IDs.

Five checks, ten minutes, and they catch the large majority of what goes wrong. Module 8 turns “look at the smallest and largest” into a proper chart.

Quick check

A school builds a dashboard from attendance data where late arrivals were logged as absences all semester. The charts look great. What can you say about them?

Let’s take it slower

Try it this way: a chart is a photocopy of the table underneath it. A photocopier doesn’t fix a smudge, it copies it, and the copy looks just as official as the original. Averages, pivots and models are all photocopies of the same page. If the page had a typo, a duplicate or a fake zero, every copy has it too. So when a number surprises you, don’t argue with the chart. Go find the page it was copied from and check that first.

More examples

1

The route through a closed road

A map app sends cars down a road that has been closed for a year because its road file never got updated. The routing math is perfect. It’s perfectly computing directions on a map that’s wrong.

2

The recipe scaled from a typo

A recipe site lists 1 tablespoon of salt where the author meant 1 teaspoon. The “scale to 12 servings” button multiplies the typo faithfully, and dinner is ruined by 3 tablespoons of salt. The scaling worked, the input didn’t.

Back to the question

So what happens to everything built on a dirty table?

Show the answer

It’s all wrong, and it all looks fine. Ashley’s average, her best game and her video count all changed when the table did. The pitch she almost sent would have quoted a hundred million average views to a store owner who could count.

One last question

Why did every chart change when Ashley cleaned the table?

Talk Card

Talk Card · 5.4

Every chart and model inherits the mess in the table it came from. Clean first, or everything downstream lies with a straight face.

Data to AI · pettigrewlab.com/learn

Next lesson