Examples
import numpy as np
import pandas as pd
index = pd.MultiIndex.from_tuples([('one', 'x'), ('one', 'y'),
('two', 'x'), ('two', 'y')])
s = pd.Series(np.arange(2.0, 6.0), index=index)
s
s.unstack(level=-1)
s.unstack(level=0)
df = s.unstack(level=0)
df.unstack()