How to Clean Data with Python
Turn messy files into analysis-ready tables: write regular expressions with Python's re module, diagnose untidy data, combine many files, reshape with melt and pivot, remove duplicates, split and parse text columns, fix types and handle missing values with pandas.
- Intermediate level
- 4 modules
- 17 lessons
- 55 tasks and questions
Syllabus
01Regular ExpressionsDescribe text with patterns: literals, alternation, character sets, wildcards, ranges, shorthand classes, quantifiers, groups and anchors, then search, extract, split and replace with Python's re module.7 lessons
02Tidy DataRecognize untidy data, then fix its structure with pandas: inspect a new dataset, combine many files into one table, reshape between wide and long, and remove duplicate records.4 lessons
03Cleaning ColumnsFix the contents of columns: split text by position or delimiter, check and convert types, parse values with regular expressions, and decide what to do about missing values.5 lessons
04Project: Cleaning City Survey FilesApply the whole toolkit to a city's neighborhood survey: combine files, remove duplicates, parse money, split packed counts, fill gaps from other columns and answer a question with the clean table.1 lesson