DeskFluent
Module 4 Pro8 min read

Project: the data cleaner

Trim spaces, fix capitalisation and remove duplicates automatically.

Module 2 warned you that real-world data is always messy — "delhi" next to "Delhi" next to "DELHI ", stray spaces, duplicated rows — and showed you formulas to fight it, one column at a time. This project upgrades the weapon: a script that cleans a whole file in one run, and — the real prize — cleans next week's file the same way with zero extra effort.

Meet the mess

Make a file called customers.csv with these rows (dummy data, as always — invented people, example.com emails):

name,city,email Priya Sharma ,london,priya@example.com amit verma,LONDON,amit@example.com Sara Khan,London ,sara@example.com Priya Sharma ,london,priya@example.com Leo Martin,sydney,leo@example.com

Five rows, three enemies hiding in them:

  • Stray spaces — "Priya Sharma " ends with an invisible space; " amit verma" starts with two.
  • Inconsistent capitals — london, LONDON and London are the same city to you, and three different cities to a computer.
  • Duplicates — Priya appears twice, character for character.

None of these shout. All of them poison your numbers: a report grouping by city would show London three times with a third of the total each, and Priya would be counted twice. This is the whispering wrong number from Module 2, at its favourite hiding spot.

Keep reading with Pro

You are reading the free preview. Module 1 of every course is free forever — Pro unlocks the rest of this lesson, every other module of every course, removes ads, and adds workbooks and certificates.