Data cleaning often takes most of a project's time. Doing it systematically makes results trustworthy and repeatable.
Clean in Code, Not by Hand
Write cleaning steps as scripts or notebooks that run from the raw data. Manual edits in spreadsheets can't be repeated on next month's data and leave no record.
Keep the Raw Data
Never overwrite the original. Clean into a new dataset so you can always start again.
Common Steps
- Fix types: parse dates, convert numeric text, keep identifiers as strings.
- Standardise text: trim whitespace, consistent case, unify spellings ("NSW", "N.S.W.", "New South Wales").
- Handle missing values deliberately.
- Remove or merge duplicates, defining what counts as the same record.
- Validate ranges and codes against rules.
- Standardise units and currencies.
- Fix structural issues: split combined columns, reshape wide and long tables.
Check After Every Step
Compare row counts and summary statistics before and after each change. Unexpected drops in rows often reveal a bad join or filter.
Document Decisions
Record what you changed and why: which outliers were removed, how duplicates were resolved, what assumptions were made.
Fix Problems at the Source
When the same problem recurs, raise it with the data owner. Fixing data entry or collection is better than cleaning the same mess forever.
Test Your Cleaning
Write simple checks — no duplicate IDs, no negative prices — that run automatically on cleaned data.