0Pricing
Data Science Academy · Lesson

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

  1. Wide vs Long, and Tidy Data
  2. pivot_table for Cross-Tabs
  3. melt to Go Long
  4. stack, unstack, and MultiIndex
← Back to Data Science Academy