Data Cleaning Exercises

Learning path · Python

pandas practitioner: cleaning with Python

Override the pandas defaults that change results: null-key merges, whitespace, NA strings, float money and unstable sorts.
  1. 1.

    Lesson · 9 min

    Import everything as text first

    Read text as text.

  2. 2.

    Exercise · beginner

    Keep identifiers as text and parse yes/no flags

    Identifiers stay strings; flags become booleans.

  3. 3.

    Lesson · 10 min

    Override the pandas defaults that change your data

    The defaults to override.

  4. 4.

    Exercise · beginner

    Join orders to customers without matching blanks

    merge matches <NA> to <NA>.

  5. 5.

    Exercise · beginner

    Normalize names without changing letters

    Strip the right characters; normalize to NFC.

  6. 6.

    Lesson · 8 min

    Exact decimals for money

    Decimal for money.

  7. 7.

    Exercise · intermediate · Pro

    Sum amounts by currency, without converting

    Locale-aware amounts, totals per currency.

  8. 8.

    Lesson · 9 min

    Fit on training data only

    Fit on train only.

  9. 9.

    Exercise · advanced · Pro

    Fill gaps with a median learned from training data only

    Median imputation without leakage.

  10. 10.

    Exercise · intermediate · Pro

    Resolve customer records by normalized email

    Stable sorts for survivor rules.