FREE COURSE / REAL PRACTICE
Cleaning real-world data with Python
Turn messy CSV and JSON into validated records, safe joins and an auditable sales report using Python's standard library.
What you’ll work toward
Parse CSV and JSON, apply explicit conversion and missing-value policies, account for rejected rows, distinguish duplicates from conflicts, preserve join grain and reconcile an offline sales report.
Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.
Before you start
This course builds on these skills:
Individual lessons can add prerequisites. The course map shows your actual readiness.
A look inside the first lesson
CSV and JSON: structure before meaning
import csv
import io
import json
text = 'id,name,visits\n001,"Lee, Ada",0\n'
row = next(csv.DictReader(io.StringIO(text, newline="")))
print(row['id'], row['name'], type(row['visits']).__name__)
print(json.loads('[{"visits":0,"note":null}]')[0])Your course outline
Follow the lessons in curriculum order. Open a unit to preview the ideas you’ll work with.
Record structure and value policies
- LESSON 01.01
CSV and JSON: structure before meaning
Parse quoted CSV and typed JSON while rejecting ambiguous headers, ragged rows and duplicate object members.
Open lesson - LESSON 01.02
Schemas and deliberate conversion
Normalize a small schema with explicit allowed conversions and one indexed error for every rejected input row.
Open lesson - LESSON 01.03
Missing, invalid and observed zero
Keep missing observations separate from invalid data and zero; compute summaries with an explicit denominator.
Open lesson
Identity, exact values and safe relationships
- LESSON 02.01
Keys, duplicates and conflicting evidence
Normalize business keys, keep the first valid record and distinguish repeated evidence from conflicting payloads.
Open lesson - LESSON 02.02
Dates, currency and finite numbers
Apply strict calendar and currency grammars, preserve exact integer cents and reject non-finite numeric observations.
Open lesson - LESSON 02.03
Join contracts and fanout checks
Enforce a many-to-one relationship before enriching rows; preserve left-row grain and expose unmatched keys.
Open lesson