Reshaping with pd.DataFrame.stack and pd.DataFrame.unstack
Before we jump into the terms stacking and unstacking, let’s take a step back and compare two tables of data. Do you notice anything different about:
a |
b |
c |
|
x |
1 |
2 |
3 |
y |
4 |
5 |
6 |
Table 7.1: A table in wide format
compared to:
x |
a |
1 |
x |
b |
... |