pandas in practice
Reading and writing files correctly, method chains and fast vectorised code, and a complete analysis from question to report.
About 5 hours of study
Learning objectives
- Read and write files with the right options
- Write readable and fast pandas code
- Run a checked analysis from question to report
Lessons
- 1
Reading and writing files Intermediate
Getting data in and out of pandas: read_csv with separators, missing-value markers, column selection, types, dates and chunks; writing with to_csv and its quoting rules; and the other formats pandas reads and writes.
- 2
Method chaining, apply and performance Advanced
Writing clear, fast pandas: method chains with assign, query and pipe, when apply with axis=1 is acceptable and how to replace it with vectorised code, np.where and np.select, and avoiding the SettingWithCopyWarning.
- 3
A complete analysis with pandas Advanced
One analysis from start to finish: framing the question, loading and inspecting, cleaning, merging, grouping, ranking with nlargest, computing shares and per-customer summaries, checking the numbers and presenting the result.
Module practice
- pandas: Read a file with its separatorEasy
- pandas: Write CSV with correct quotingMedium
- pandas: Totals from a file read in chunksHard
- pandas: assign, query, sort_valuesEasy
- pandas: A row rule without applyMedium
- pandas: A pipeline of named stepsHard
- pandas: The top n rowsEasy
- pandas: Revenue and share by categoryMedium
- pandas: A per-customer summaryHard