liveBook · Manning

Data cleaning

As explained in Data Without Labels

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

Data cleaning checks and treats quality problems before data is used for analysis or modeling. Raw business data may contain duplicates, missing values, outliers, and variables that need further treatment. Cleaning belongs alongside data discovery and preprocessing: the quality of the raw data and the rigor of cleaning affect the reliability of the final analysis. section 11.4 section 1.2.3

Start with a dataset sanity check, then decide which treatments fit the business problem:

  • Count records and inspect missing, duplicate, and junk values. Check whether a variable is too sparse or carries little information before retaining it. section 3.8
  • Inspect outliers and whether seasonal, daily, and weekly patterns are adequately represented. Resolve incompatible date formats when loading data from different sources. section 1.2.3
  • Identify categorical variables and any additional variables or treatments the intended model needs. section 11.4

Deciding whether a variable helps

In a customer dataset, a gender field populated for only 0.01% of customers may be too sparse to keep. A field with the same value for every customer adds no distinguishing information. Both decisions require checking the data and its business meaning, not simply dropping columns by habit. section 3.8

Text needs its own cleaning choices. Reviews, comments, and similar sources may contain URLs, punctuation, unwanted characters, and low-value words. Options include stop-word removal, frequency-based removal, customized word lists, and normalization through stemming or lemmatization. Removing words can reduce complexity, but context matters: “it is” can be a complete answer, so deleting those words could discard useful meaning. Python libraries such as nltk can support text parsing and preprocessing. section 7.6 section 7.20

How Data Without Labels covers it

How deep it goes
Details quality checks and context-dependent text-cleaning choices, but does not specify a universal treatment for every dirty value.
Examples
Uses sparse or constant customer attributes, incompatible date formats, and context-sensitive stop words to illustrate cleaning decisions.
What it assumes
Assumes a selected dataset and business problem, while introducing basic checks before exploratory analysis.
What you can do after
Practice/perform it by checking duplicates, missing values, junk, and outliers, then choosing treatments suited to the dataset.
How it connects
Links data quality and preprocessing to exploratory data analysis, dimensionality reduction, tokenization, and text representation.

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 Data Without Labels. The section links point to the parts of the book it draws on.