create matrice 2d whit 3colum panda

Solutions on MaxInterview for create matrice 2d whit 3colum panda by the best coders in the world

showing results for - "create matrice 2d whit 3colum panda"
Manuel
31 Feb 2020
1>>> df
2   row  col  grumpiness
30    5    0    0.846412
41    0    1    0.703981
52    3    1    0.212358
63    0    2    0.101585
74    5    1    0.424694
85    5    2    0.473286
9
10>>> df.pivot_table('grumpiness', 'row', 'col', fill_value=0)
11col         0         1         2
12row                              
130    0.000000  0.703981  0.101585
143    0.000000  0.212358  0.000000
155    0.846412  0.424694  0.473286
16