Free courses in AI, Data Science & Machine Learning Written lessons · Quizzes · Final exams
Future Data Academy
Log inGet started ↗
← Data Cleaning and Preparation
FREE LESSON PREVIEW

Data contracts and quality reports

The decision

A delivery file mixes kilometres and metres, repeats identifiers and includes an impossible negative travelled distance. Cleaning should follow a contract describing units, allowed values and duplicate rules. Preserve raw values so another analyst can reconstruct every decision.

Synthetic case data

id,distance,unit
a,1.2,km
b,500,m
c,-2,km
a,1.2,km
d,,m

Work it through

Before reading the worked analysis, identify the unit of observation, required quantities and missing information. Write your own answer, including units and a limitation.

Worked analysis

Retain one a and quarantine negative c. Valid distances are 1200 and 500 metres, total 1700 and mean 850 over two observations. Record one duplicate, one invalid distance and one missing distance. Dividing by all five rows gives the wrong valid-observation mean. A missing distance is unknown, not zero. Negative refunds can be legitimate in sales, so validity depends on field meaning. Document each transformation, its reason and the input/output counts. Unsupported units must be resolved or quarantined rather than guessed.

Independent challenge

Produce a data dictionary, cleaning specification, row-disposition table and quality summary. Add tests for blank IDs, unsupported units and conflicting duplicates. Explain which errors block publication and which can be reported as coverage limitations.

Acceptance checks

Reconcile five input rows to two valid, one duplicate, one invalid and one missing. Record conversion factors. Label 1700 as observed valid distance, not necessarily the complete operational total.

Further reading

Official reference. This original academy exercise uses synthetic data; the reference provides background and does not endorse the academy.

Explore the full course →