In [5]:
import pandas as pd
data = {'A':['foo','foo','foo','bar','bar','bar'],
'B':['one','one','two','two','one','one'],
'C':['x','y','x','y','x','y'],
'D':[1,3,2,5,4,1]}
df = pd.DataFrame(data)
In [6]:
df
Out[6]:
In [3]:
df.pivot_table(values='D',index=['A', 'B'],columns=['C'])
Out[3]:
In [7]:
pwd
Out[7]:
No comments:
Post a Comment