create matrice 2d whit 3colum panda code example
Example: create matrice 2d whit 3colum panda
>>> df
row col grumpiness
0 5 0 0.846412
1 0 1 0.703981
2 3 1 0.212358
3 0 2 0.101585
4 5 1 0.424694
5 5 2 0.473286
>>> df.pivot_table('grumpiness', 'row', 'col', fill_value=0)
col 0 1 2
row
0 0.000000 0.703981 0.101585
3 0.000000 0.212358 0.000000
5 0.846412 0.424694 0.473286