Clean Messy Data with Pandas 3: End to End, 3 Mistakes
Clean a messy CSV with pandas 3 from start to finish in about twenty lines, and check your work with counts. Includes three real mistakes.
Video #09 ยท Python for data
Steps in the video
Files
- clean.py (26 lines)
- gotchas.py (23 lines)
- messy.csv (9 lines)
Tested with
Python 3.12.15 | pandas==3.1.0
What this does not show
One small made-up orders file, cleaned with rules chosen for it; the chained assignment trap is shown for pandas 3.1.0 on Python 3.12 only, and day-first or mixed date formats are not covered.
Sources
Learning IT by Example.