Day 13 of 14 35 minMethod chainingCategoricalsPerformance
Write pandas that is fast, readable and correct. Chain steps into a clear pipeline, avoid the chained-assignment trap and SettingWithCopyWarning, save memory with categoricals and smaller types, and replace slow row-by-row loops with vectorised code.
By the end of today you can
- Write analysis as a readable method chain with assign(), query() and pipe()
- Explain the chained-assignment trap and fix it with loc and copy()
- Measure memory with memory_usage() and shrink it with categoricals and smaller types
- Replace iterrows() and apply() with vectorised code where possible
- Load only the columns and types you need with read_csv()
What's inside
- 4 sections
- 3 diagrams and mind maps
- 10 code examples you can run
- 5-question quiz
- 1Method chaining: analysis as a pipeline
- 2The chained-assignment trap
- 3Memory: categoricals and smaller types
- 4Speed: vectorise, don't loop
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free