In [76]:
import pandas as pd
import numpy as np

In [103]:
index = pd.MultiIndex.from_product([range(100), range(10)], names=['A', 'B'])
df = pd.DataFrame({'C': np.random.randn(1000)}, index=index)

In [105]:
df.head(20)


Out[105]:
C
A B
0 0 0.167615
1 0.251621
2 1.099555
3 0.665899
4 -1.639039
5 0.264176
6 -0.321309
7 -0.621483
8 0.877181
9 0.460579
1 0 0.861043
1 -1.239397
2 -0.344292
3 -0.440770
4 -0.295431
5 -0.616670
6 -1.271621
7 -0.620415
8 -0.763932
9 -0.743809

In [106]:
df['C'] += index.get_level_values(1)

In [107]:
df.head(20)


Out[107]:
C
A B
0 0 0.167615
1 1.251621
2 3.099555
3 3.665899
4 2.360961
5 5.264176
6 5.678691
7 6.378517
8 8.877181
9 9.460579
1 0 0.861043
1 -0.239397
2 1.655708
3 2.559230
4 3.704569
5 4.383330
6 4.728379
7 6.379585
8 7.236068
9 8.256191

In [109]:
df2 = df.unstack(1)

In [112]:
df2.plot(kind='box', figsize=(8,6))


Out[112]:
<matplotlib.axes._subplots.AxesSubplot at 0x10b240410>

In [ ]: