TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is data preparation? Steps, examples and common mistakes

Data preparation turns raw data into a clean, consistent dataset ready for analysis. The steps with the checks that go with each, a worked example where preparation changes average order value, and how to prevent problems at collection time.

Lin Zhou Reviewed by Su He Also called data prep Last updated Nov 7, 2026 Glossary

Quick answer

Data preparation is the process of collecting, cleaning, transforming and validating raw data so it is accurate, consistent and structured for analysis, reporting or machine learning.

What is data preparation?

Data preparation is the work of turning raw data into a dataset you can trust and analyse: collecting it from its sources, cleaning errors, transforming it into a consistent structure and validating the result. It comes before every chart, report and model, and it decides whether their numbers are right.

In the CRISP-DM process model, data preparation is a phase of its own between understanding the data and modelling. In interviews with enterprise analysts, Kandel and colleagues (2012) found that discovering, wrangling and profiling data took up much of analysts' time and was one of their main frustrations.

Why it matters

Most wrong numbers in a meeting are not caused by bad statistics. They come from preparation problems: test orders counted as revenue, the same customer counted twice, dates in different time zones, refunds treated as sales. A careful analysis on badly prepared data is still wrong.

The steps, with what to check

StepWhat you doChecks
1. Define the questionWrite the metric and its definitionWhich rows count? Which date? Which currency?
2. CollectPull data from each sourceRow counts match the source; date range complete
3. ProfileLook at every columnMissing values, distinct values, min/max, unexpected types
4. CleanFix or remove bad rowsDuplicates, test and internal data, invalid values, outliers (how to handle them)
5. TransformReshape for the analysisUnits and currencies, time zones, derived fields, joins, aggregation
6. ValidateCompare with a trusted totalRevenue matches finance within a known gap; counts match the dashboard
7. DocumentRecord what you didFilters, exclusions and definitions in a data dictionary

The cleaning techniques themselves are covered in more depth in data cleaning techniques.

Tidy data

Hadley Wickham's "tidy data" rules describe the target shape for most analysis:

  1. Each variable is a column.
  2. Each observation is a row.
  3. Each type of observational unit is a table.

An export with one column per month ("Jan", "Feb", "Mar") is not tidy: the month is a variable spread across columns. Reshaping it to month, value rows makes filtering, charting and joining straightforward.

A worked example: average order value

Sample data: a monthly export of 10,000 orders with $642,000 in revenue, giving an average order value of $64.20.

Preparation stepRowsRevenueAOV
Raw export10,000$642,000$64.20
Remove 312 test orders ($10 each, from the staging coupon)9,688$638,880
Remove 145 duplicate orders (double submits, $65 each)9,543$629,455$65.96
Flag 88 refunded orders (kept, marked)9,543$629,455

The test orders were small and the duplicates were average-sized, so cleaning raised AOV by $1.76 (2.7%). Had the duplicates been left in, revenue would have been overstated by $9,425 that finance never received. Refunds were flagged rather than removed so the analysis can report gross and net separately.

Data preparation for machine learning

Machine learning adds three steps: labelling the outcome you want to predict, splitting data into training and test sets before any transformation that learns from the data (otherwise information leaks from test to training), and encoding categories and scaling numbers so the algorithm can use them.

Common mistakes

  • Deduplicating on the wrong key, such as email instead of order ID, which merges real separate orders.
  • Mixed time zones. A UTC server log joined to a local-time order table shifts late-evening orders to the next day.
  • Silent type changes. Spreadsheets turn product codes like 00123 into 123 and long IDs into scientific notation.
  • Filtering without recording it. Six months later nobody knows why the numbers differ from the dashboard.
  • Leakage in models. Using a field that is only known after the outcome (such as "cancellation reason" to predict churn).

Tools

Spreadsheets for small, one-off work; SQL for anything that lives in a database; Python (pandas) or R for repeatable analysis; dbt or similar for transformations that run on a schedule. Whether you transform before or after loading is the ETL vs ELT choice.

Preparing data in TapCub

The cheapest preparation is the problem that never enters the data. TapCub moves several checks to collection time:

  • Validation rules in All-platform analytics › Data › Property dictionary: expected type, required, regex, length, min/max and allowed values, each set to warn, drop the property or block the event.
  • Typed properties: each key is String, Number, Boolean, Datetime or List, so sums and filters do not break on mixed types.
  • Virtual events and properties define or rename behaviour after the fact, with a backfill of up to 365 days.
  • Exclusion rules keep internal and test traffic out; known bots are counted separately from visitors.

When you still need a notebook or warehouse, export raw data or query it with SQL.

Sources

Was this explanation clear?

We use your answers to fix and expand this page.

Lin Zhou

Product Experience Specialist

Writes about product experience, practical workflows, and growth, turning complex processes into clear steps for everyday decisions.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What are the steps of data preparation?

Define the question, collect the data, profile it, clean it (duplicates, types, missing values, outliers), transform it (units, derived fields, joins, aggregation), validate the result, then document and publish it.

What is the difference between data preparation and data cleaning?

Data cleaning fixes errors in the data. Data preparation is broader: it also includes collecting, combining, reshaping and validating the data for a specific analysis.

Why does data preparation take so long?

Because every source has its own formats, gaps and quirks, and many problems only appear when you join sources or compute a metric. Moving validation to collection time removes much of the work.

Is data preparation part of ETL?

Largely, yes. In ETL the transform step prepares data before loading; in ELT raw data is loaded first and prepared inside the warehouse.

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics