liveBook · Manning

Data cleaning

As explained in The Well-Grounded Data Analyst

Data cleaning is the process of detecting, correcting, standardizing, or removing inaccurate, inconsistent, incomplete, or irrelevant data.

Data cleaning turns inconsistent, incomplete, or ambiguous records into data suitable for analysis. A practical workflow inspects quality first, preserves raw values, and adds cleaned fields for comparison. section 2.2.2

A useful cleaning workflow includes:

  • Check shape and missing values before transforming records; decide whether incomplete rows should be removed or retained. section 2.2.2
  • Standardize representations such as letter casing, punctuation, and unwanted markers. section 2.2.2
  • Explore structural variation instead of assuming every record has the same number or position of fields. section 2.2.2
  • Use an external reference list to classify records, then inspect unmatched cases and add justified exceptions. section 2.2.2
  • Keep an explicit fallback category such as OTHER when classification remains unresolved, and account for it in later analysis. section 2.2.2

Distinguishing London addresses

Searching for LONDON can incorrectly include addresses such as London Road. Uppercasing a separate address_clean column and matching the address-line pattern LONDON, reduces this ambiguity; comparing both counts reveals the practical effect of the rule. section 2.2.2

customers["address_clean"] = customers["address"].str.upper()

Inspect the executable transformation that creates a consistently cased address column while preserving the original address. section 2.2.2

How The Well-Grounded Data Analyst covers it

How deep it goes
Explains inspection, standardization, matching, fallback categories, and exceptions, but stops short of a general automated validation framework.
Examples
Demonstrates address casing, delimiter matching, variable-length records, reference city lists, unmatched cases, and customer-spend summaries.
What it assumes
Assumes tabular records and a reference list, while demonstrating missing-value checks and transformations from the beginning.
What you can do after
Apply it via pandas to inspect, standardize, classify, and summarize imperfect tabular data.
How it connects
Connects data cleaning with missing values, exploratory analysis, data pipelines, and geographic classification.

Also explained in

Compare how 14 books explain data cleaning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Data Analyst. The section links point to the parts of the book it draws on.