05/08/2026
Data Cleaning = getting messy raw data ready so your analysis doesnβt lie to you.
"Garbage in = Garbage out"
β
The 5 Key Steps in Data Cleaning
π Handle Missing Values
- Problem: Blank cells, `NULL`, `NaN`
- Fix: Delete row, fill with mean/median/mode, or flag as "Unknown"
- Why: Missing data breaks calculations and skews results
π Remove Duplicates
- Problem: Same transaction/customer recorded 2-3 times
- Fix: Use `DISTINCT` in SQL or `df.drop_duplicates()` in Python
- Why: Duplicates inflate revenue, counts, and give wrong insights
π Fix Data Types + Format
- Problem: Dates as text, numbers as text, inconsistent formats `1/5/25` vs `2025-01-05`
- Fix: Convert to correct types: `date`, `int`, `float`. Standardize case: `Lagos` not `lagos`
- Why: You canβt sum text or filter dates if the type is wrong
π Handle Outliers + Errors
- Problem: Age = 250, Sales = -$5000, typo in category names
- Fix: Cap, remove, or investigate. Use IQR/Z-score or business rules
- Why: 1 outlier can ruin your average and dashboard
π Standardize + Validate
- Problem: `Nigeria`, `NG`, `Naija` all mean same country
- Fix: Create mapping/lookup table. Check ranges and logic rules
- Why: So joins, groupbys, and dashboards are accurate
β
Line Summary
Data Cleaning: Find errors β Fix them β Make data consistent β So analysis is trustworthy
Rule of thumb: Analysts spend 60-80% of their time cleaning.