Convert pandas df to 4 dimensions tensor

Hello,

I have a panda dataframe with several columns, and I would like to convert it in a tensor of 4 dimensions.

One of the pandas column is dates, and I want it to be one of the dimensions for example.

Sample of my data:

date        view  node   neigbor  link_value|

|20161104||   286|  1 10753|   1|
|20161104|   293|  1  10753|   1|
|20161104||  701|  1 . 10753|   1|
|20161104|| . 122|  1  10753|   1|
|20161105|| . 286|  1   10753|   1|
|20161105|| . 293|  1 10753|   1|
|20161105||  701|  1  10753|   1|
|20161105|| . 122|  1  10753|   1|

I would like the date and the view as dimensions, and then have a matrix with node as row, neighbor as column, and link weights as values in the matrix.

Thank you so much !!!

1 Like