Data cleaning & preparation

Real-world data is messy. Data cleaning means finding and fixing problems before the data is used. It's not glamorous, but data teams often spend most of their time on it, because a model trained on messy data gives messy answers.

Everyday analogy

Washing, peeling and sorting vegetables before cooking. Skip it and the whole dish suffers, however good the recipe.

Example

A customer list has "Bangalore", "Bengaluru" and "BLR" as three different cities. Until they're merged, any analysis will think they are three separate places.

🧺Messy data• delhi, DELHI, New Delhi • age: blank, 250• duplicate rows✨Clean data• Delhi• age: 34 (or flagged)• one row per order→
Data cleaning fixes spelling, gaps, impossible values and duplicates.

Before cleaning

NameCityAgeJoinedProblem
Asha RaoBangalore3412/03/2024City spelt three ways
asha raoBengaluru342024-03-12Duplicate person, mixed date formats
VikramBLR2502024-05-01Impossible age (outlier)
NehaMumbai2024-06-20Missing age

After cleaning

NameCityAgeJoined
Asha RaoBengaluru342024-03-12
VikramBengaluru25 (confirmed typo)2024-05-01
NehaMumbaiunknown (flagged)2024-06-20
DuplicatesRemove repeated records of the same thing.
Missing valuesFill sensibly, mark as unknown, or drop the record.
InconsistenciesOne spelling, one date format, one unit.
OutliersCheck impossible or extreme values before trusting them.

Try it yourself

About 20 min

Clean a messy table

  1. In a spreadsheet, type 10 rows of customer data with mistakes: duplicates, 'Delhi' and 'delhi', blank ages, an age of 250.
  2. Fix them using sort, find-and-replace and filters.
  3. Write the rules you used.

What you should see: Data cleaning is the unglamorous step that makes AI work.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectClean and analyse a messy sales fileAbout 60 min · No coding needed · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.