Ravindra BagaleCourses & study guides मराठी Track your progress

5. Data Cleaning A–Z

Come friends, today we learn the most important job of all: data cleaning. In a real job an analyst spends a lot of time cleaning data: duplicates, blanks, extra spaces, "pune/PUNE/Pune", numbers stored as text, mixed-up dates, phone numbers… For every problem there is a BEFORE (messy) and an AFTER (clean) table, with steps and formulas. At the end we clean a full Blinkit export from start to finish. Do not worry – one problem at a time.

What you will learn in this module

  • Finding and removing duplicates, blanks, extra spaces and non-printable characters
  • Fixing case, inconsistent city names (pune / PUNE / Aurangabad → Sambhaji Nagar) with Find & Replace and a mapping table
  • Converting numbers stored as text and text dates into real numbers and dates
  • Splitting and merging columns; cleaning phone numbers, e-mails, pincodes and codes
  • Extracting parts of text, removing unwanted characters, handling outliers and error values
  • The unpivot idea, and a full end-to-end cleaning of one messy Blinkit export

Live story: The export that adds up wrong

Suppose the October Blinkit export lands at 9 am and the total says ₹5,980, but the city managers' total is ₹4,730. The file has one order twice, " pune" with a space, ₹ signs inside numbers and dates typed as text. Nobody can trust the report until it is clean. This chapter fixes every problem with a BEFORE and AFTER table, and ends with one full clean-up.

All numbers in this story are fictional practice data.

Golden rules before cleaning

1) Keep the original export untouched on a sheet called Raw and clean a copy. 2) Clean with helper columns and formulas first, check, then Copy › Paste Special › Values and delete the helpers. 3) Count rows and total amount before and after – they must reconcile. 4) If you will receive the same messy file every week, record the steps in Power Query (Module 10) instead of repeating them by hand.

Concepts in this chapter

  1. 5.1Duplicates
  2. 5.2Blank Cells
  3. 5.3Extra Spaces and Non-printable Characters
  4. 5.4Inconsistent Case
  5. 5.5Inconsistent City Spellings
  6. 5.6Numbers Stored as Text
  7. 5.7Text Dates and Mixed Date Formats
  8. 5.8Splitting Columns
  9. 5.9Merging Columns
  10. 5.10Phone Numbers
  11. 5.11E-mail Addresses
  12. 5.12Pincodes and Codes with Leading Zeros
  13. 5.13Extracting Parts of Text
  14. 5.14Removing Unwanted Characters
  15. 5.15Outliers
  16. 5.16Error Values in Data
  17. 5.17Unpivot: Wide to Long (Concept)
  18. 5.18End-to-End: Cleaning a Messy Blinkit Export

Review and practice

  1. ★Practice and Answer Key: Cleaning a Messy Export

The chapter recap is at the end of the last concept page.

Quick revision cards

Quick revision

Revise this chapter in two minutes. Save the cards on your phone or download them as PNG files. All names and numbers are made up for practice.

Revision card: Data cleaning: TRIM, PROPER and VALUE. Example data table with Remove extra spaces in the Raw value cell: pune; Fix the capital letters in the Raw value cell: Nashik; Turn text "450" in the Raw value cell into a number: 450.
Card 1 of 2: Data cleaning: TRIM, PROPER and VALUE · Download PNG
Revision card: Cleaning: leading zeros, hidden spaces, text dates. Example data table with Code 007 typed as 7: 007; TRIM leaves a space after Salman in the Name for Salman␣ (CHAR 160): Salman; Is the Date for Rani a real date?: FALSE.
Card 2 of 2: Cleaning: leading zeros, hidden spaces, text dates · Download PNG

More cards for every chapter: Ravi Sir's Cards.