Data Cleaning Exercises

Task: the rules
Inputs (three files, all text)
  jan(id, amount)            feb(id, amount, channel)            bad(id, currency)

Rules
  Schema: required columns id and amount; optional column channel. No other columns are allowed.
  A file missing a required column, or containing a column outside the schema, is rejected as a whole.
  Keep every row of accepted files. A missing optional column gives a missing channel.
  source_file is the name of the file the row came from (jan, feb, …).
  amount is always a whole number in accepted files.

Output (row order does not matter)
  clean(id text, amount int64, channel text, source_file text)

Tab inserts spaces. Press Escape, then Tab, to move focus out of the editor.

Input: jan, rows 1 to 6 of 6
#idstringamountstring
1iz6d8
2rna5262
3s38t410
4pk5w345
5r8id426
6azjp425

Run preview · in your browser, not a grade

Loading the preview runtime…

Check answer · graded on an isolated server, including hidden datasets

Your code runs in a locked-down machine with no network, on the visible data and on hidden datasets that follow the same rules.

Learn from this exercise

A worked solution becomes available after your first check or once you've used every hint.

AI tutor · may be wrong; the grader decides

Python · Python 3.14 · pandas 3.0.2Preview runtime loadingNot saved yet · sign in to save to your account