# Data cleaning

> Data cleaning is the work of finding and fixing errors, duplicates, gaps and inconsistencies in a dataset, such as mismatched formats or misspelt names, so that reports, automations and AI models built on it give reliable results.

Also called: data cleansing, data scrubbing, data preparation, data wrangling, deduplication. Category: Data and retrieval. Source: https://aibuildindex.com/glossary/data-cleaning

## In the index

- pandas: median $2,480, middle half $500 to $8,000, 53 priced briefs (https://aibuildindex.com/skills/pandas)
- Data analysis: median $3,500, middle half $500 to $9,680, 972 priced briefs (https://aibuildindex.com/skills/data-analysis)

Real business data is untidy. The same customer appears three times with different spellings, dates are written four ways, some prices include tax and some do not, and a third of the rows have a blank where the region should be. Data cleaning is the patient work of putting that right. It is rarely mentioned in AI sales pitches, yet it is often the largest single task in a forecasting, analytics or machine learning project, because a model trained or prompted on bad data produces bad answers with full confidence.

## How it works

Cleaning usually follows a pattern:

- **Profile.** Look at what is actually there: value ranges, blank rates, formats, obvious outliers.
- **Standardise.** Put dates, currencies, phone numbers, units and category labels into one format.
- **Deduplicate.** Match records that refer to the same thing, which may need fuzzy matching on names and addresses.
- **Handle gaps.** Decide, field by field, whether to fill a missing value, flag it or drop the row.
- **Validate.** Apply business rules, such as order dates not being in the future or totals matching line items.

Tools range from spreadsheets and Python libraries such as pandas to SQL in a [data warehouse](https://aibuildindex.com/glossary/data-warehouse). Language models now help with the fuzzier tasks: normalising free-text job titles, mapping messy product names to a catalogue, or splitting an address field into parts. Their output still needs checking, because a confident wrong mapping is worse than a blank.

For anything recurring, the cleaning rules should live in the [data pipeline](https://aibuildindex.com/glossary/data-pipeline) rather than being done by hand each time, so the same fixes are applied to new data automatically.

## What it means for cost

Data cleaning is the most common reason AI and analytics projects take longer than quoted. The effort is hard to estimate until someone has looked at the data, which is why careful builders ask for a sample or propose a short discovery phase before fixing a price. Questions worth asking:

- Has the builder seen a sample of the real data, not a description of it?
- Which cleaning decisions need input from the business, such as which duplicate record wins?
- Will the cleaning be repeatable for new data, or a one-off?

A buyer who can supply clean, well-documented data will usually get a lower quote and a faster build.

## Common questions

### Can AI clean data automatically?

Partly. Models are good at standardising messy text and suggesting matches, and they speed up the work considerably. They also make plausible mistakes, so a sensible build has them propose changes, applies rules to check them, and sends uncertain cases to a person.

### How long does data cleaning take?

It depends entirely on the state of the data and how many sources are involved. A single tidy export can be cleaned quickly; years of records from several systems with no shared IDs can take longer than the modelling itself. A short look at a real sample is the only reliable way to estimate it.

## Related terms

- [ETL (extract, transform, load)](https://aibuildindex.com/glossary/etl): ETL, short for extract, transform, load, is the process of copying data out of source systems, cleaning and reshaping it into a consistent form, and loading it into a destination such as a data warehouse or reporting database.
- [Data pipeline](https://aibuildindex.com/glossary/data-pipeline): A data pipeline is an automated series of steps that moves data from one or more sources to a destination, transforming, checking and enriching it along the way, on a schedule or as new data arrives.
- [Training data](https://aibuildindex.com/glossary/training-data): Training data is the set of examples a machine learning model learns from, such as labelled images, past transactions or question-and-answer pairs, and its quality, coverage and rights largely decide how well the finished model performs.
- [Data extraction](https://aibuildindex.com/glossary/data-extraction): Data extraction is the process of pulling specific fields or records out of unstructured or semi-structured sources, such as documents, emails, web pages or transcripts, and returning them in a consistent, structured format.
- [Data warehouse](https://aibuildindex.com/glossary/data-warehouse): A data warehouse is a central database designed for analysis, where cleaned data from many business systems is stored together so teams can run reports, dashboards and AI queries across all of it.
- [Forecasting](https://aibuildindex.com/glossary/forecasting): Forecasting is the use of historical data and statistical or machine learning models to estimate future values, such as next month's sales, call volumes or stock needs, usually with a range that shows how uncertain the estimate is.
