stack, unstack, and MultiIndex
Reshaping hierarchical tables.
Reshaping With the Index
Beyond melt and pivot, pandas can reshape using the index itself. The tools are stack and unstack on hierarchical labels. 🏗️
What a MultiIndex Is
A MultiIndex stacks two or more label levels on one axis, so a single row can carry both a region and a year together.
All lessons in this course
- Wide vs Long, and Tidy Data
- pivot_table for Cross-Tabs
- melt to Go Long
- stack, unstack, and MultiIndex