CodeRigor

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.

Free lessons & exercises7 authored lessons3 units

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

Python
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.

UNIT 013 lessons Record structure and value policies
  1. 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
  2. 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
  3. 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
UNIT 023 lessons Identity, exact values and safe relationships
  1. 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
  2. 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
  3. 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
UNIT 031 lesson Auditable cleaning capstone
  1. LESSON 03.01

    Capstone: clean, merge and reconcile

    Compose an offline CSV/JSON sales pipeline with deterministic row provenance, rejection ledgers and reconcilable totals.

    Open lesson