Data Cleaning Exercises

Module 1 · Inspect before changing · 7 min

Turn a profile into questions

You'll be able to: Write the open questions a profile raises, with counts and examples, before choosing rules.

Before this: Profile before you change anything

The idea

A profile is only useful if it changes what you do. For each surprising finding, write a question with the count and one example: 41 rows have a blank customer_code; may they be quarantined?

Group questions by owner (finance, operations, the source system team) so each person gets a short list.

Until a question is answered, choose the safest reversible handling and label it as an assumption.

Worked example

Input: status: shipped (812), Shipped (40), shipped␠ (9), returned (3)

Visual
Inspector → status → distinct values
SQL (DuckDB)
SELECT status, COUNT(*) FROM orders GROUP BY ALL ORDER BY 2 DESC
pandas
df["status"].value_counts(dropna=False)

Result: Questions: is case meaningful? Is 'returned' a valid status (not in the dictionary)?

Common mistakes

  • Vague questions without counts.
  • Guessing instead of asking.
  • Not recording assumptions.

Check yourself

What makes a question actionable?

It names the field, the count, an example and who can answer it.

Practice it

Profile the export and clean it under the declared rules.

Next: Clean an order-line export