sample project · synthetic data

data cleaning and preparation

a deliberately messy order export turned into a clean, analysis-ready table, with a log of every single change.

  • Python
  • pandas
  • SQL
  • 318raw rows in
  • 273clean rows out
  • 18duplicates removed
  • 27rows set aside for review

before and after

the same orders, before and after cleaning

the first six rows of the raw export, and the same orders after cleaning. look at the dates, the line names and the weights. SO-1081 is missing after cleaning because its quantity is not usable, so it was set aside for review.

before: raw export

Order IDOrder DateCustomerLineMaterialWeightQuantityStatus
SO-112928 Jun 2026Bluebird Components line b ALUMINIUM18,3 kg321shipped
SO-12532026-05-27Harbor MetalsLINE-Csteel15,71756open
SO-12212026-06-27northwind worksLINE-Aaluminium2,47879shipped
SO-100727.05.2026Kestrel Tooling Line AAluminium(empty)731cancelled
SO-109713.03.2026harbor metalsLine Cbrass10.9 kg323open
SO-108127.05.2026NORTHWIND WORKSLINE-A ALUMINIUM18,10-164shipped

after: clean table

Order IDOrder DateCustomerLineMaterialQuantityStatusWeight_kg
SO-10072026-05-27Kestrel ToolingLine Aaluminium731cancellednan
SO-10972026-03-13Harbor MetalsLine Cbrass323open10.9
SO-11292026-06-28Bluebird ComponentsLine Baluminium321shipped18.3
SO-12212026-06-27Northwind WorksLine Aaluminium879shipped2.47
SO-12532026-05-27Harbor MetalsLine Csteel756open15.71

what every step changed

steprows affected
Duplicate rows removed18
Values with stray spaces trimmed174
Customer / material names standardised256
Line labels unified (Line A / line a / LINE-A / A)185
Dates converted to one format (YYYY-MM-DD)203
Weights converted to kg (g and decimal commas)204
Weights missing or not a number (left empty, flagged)26
Rows rejected: quantity missing, negative or implausible27

all data in this project is synthetic: random numbers with a fixed seed, no real company or person. a row can be counted in more than one step.

from question to result

how the project went

  1. the challenge

    a raw order export had duplicate rows, three date formats, inconsistent names (Line A, line a, LINE-A, A), weights in kg or g with decimal commas, missing values and impossible quantities. nothing could be summed or compared reliably.

  2. the approach

    I cleaned the file with a script in six clear steps. every step is logged with the number of rows it changed, and rows that cannot be trusted are set aside in a separate file instead of silently disappearing.

  3. the result

    318 raw rows became 273 clean, analysis-ready rows. 18 duplicates were removed and 27 rows with unusable quantities were set aside for review.

the data and the code

everything is in the project folder

you can open every file, rerun the scripts and get the same result. nothing is hidden behind a screenshot.

read the project readme

run it yourself

pip install pandas
python src/generate_data.py
python src/clean.py

free consultation

got a messy export nobody trusts?

message me on whatsapp and tell me about your data. the first consultation is free.

chat with me on whatsapp

not ready to chat? send me an email instead.