Datasets:
D8: CSV Data Cleanup
Goal
Clean a messy CSV file (data/raw.csv) by fixing 5 data quality issues and
produce a clean output at data/clean.csv.
Hard Requirements
- Remove duplicate rows: Rows with identical values in the
idcolumn — keep the first occurrence. - Drop empty columns: Any column where every value is empty must be removed entirely.
- Normalize date formats: The
datecolumn contains mixed formats (MM/DD/YYYY,YYYY-MM-DD,DD-Mon-YYYY). Normalize all toYYYY-MM-DD. - Strip whitespace: Trim leading/trailing whitespace from all string cells.
- Fix delimiter errors: Some rows use semicolons instead of commas. Parse them correctly.
Output Format
- File:
data/clean.csv - Encoding: UTF-8
- Delimiter: comma
- Header row preserved (minus dropped columns)
- Sorted by
idascending (numeric sort)
Script
- Write or fix
clean.pyso thatpython clean.pyproduces the output.
Deliverables
- Working
clean.py - Correct
data/clean.csv - Verifier confirms all 5 issues resolved.