Examples

In [1]:
import numpy as np
import pandas as pd
In [ ]:
s = pd.Series([2, 3, 4, 5],
             index=pd.MultiIndex.from_product([['one', 'two'],
                                               ['x', 'y']]))
s

In [3]:
s.unstack(level=-1)
Out[3]:
x y
one 2 3
two 4 5
In [4]:
s.unstack(level=0)
Out[4]:
one two
x 2 4
y 3 5