Track 15 · Lesson 3 of 11
Combining exports
Merge many CSV exports into one file, even when their columns arrive in different orders and spellings, and remove duplicate records.
You will be able to
- Read every CSV export in a folder in a predictable order and tag each row with its source file
- Use csv.DictReader so that column order does not matter
- Normalise header spellings such as "Order ID" and "order_id" to one form
- Write a combined file with a fixed column order using csv.DictWriter
- Remove duplicate records by key while keeping the first occurrence
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.