Skip to main content

How to clean data with AI

Guide · about 7 min · refs checked 2026-11-19 (reference links and dates only)

Let AI find dirty data and propose cleaning rules, but every change must be replayable and auditable.

How to
Profile first: row count, column types, null rate, duplicate rate, outlier distribution. Do not just say “clean it”. Write the rules as a checklist: dedupe key, missing-value policy, date format, unit normalisation, outlier handling. Have AI produce executable pandas/SQL, not hand-edited result tables; keep scripts in version control. Keep before/after row counts and samples for every step; answer “what was deleted and why”. Mask sensitive fields before sending to a model; never paste a full customer table into chat. Rerun the original statistics after cleaning to confirm signal was not deleted as noise.

Example and interpretation

A teaching scenario, not a measured or executed site test.

Take a sheet with duplicates, missing dates and outlier amounts; profile it, have the model write pandas code, keep before/after counts and deletion samples, then rerun totals to confirm real large orders were not removed.

How to check your practice

Explain the example in your own words, inspect input constraints, then verify against the source. Revisit concepts if you cannot explain why; supply missing dates, fields or permissions; withdraw unsupported conclusions.

For this topic, start with concept confusion · See all six scenarios and their reasoning

Sources
  • pandas 10 minutes to pandas ↗
  • OpenAI text and data analysis guide ↗