Pandas > Pivot table

Name
Code
Output
dataframe = pandas.DataFrame(numpy.random.randint(0,4,size=(5, 3)), columns=['C1','C2','C3'])
print ("dataframe")
print (dataframe)
pivot = pandas.pivot_table(dataframe, values='C3', index=['C1'], columns=['C2'], aggfunc=sum)
print ("pivot")
print (pivot)
dataframe
   C1  C2  C3
0   1   0   3
1   1   3   0
2   1   0   2
3   2   0   2
4   1   2   2
pivot
C2    0    2    3
C1               
1   5.0  2.0  0.0
2   2.0  NaN  NaN