How to convert a Pandas DataFrame of Lat Lon coordinates into a matrix? (Python)

Viewed 456

I have a DataFrame of satellite data points. The points are arranged in an evenly spaced grid that is slightly rotated from North South. I want to transform this data into a matrix that I can feed into a Convolutional Neural Network. I want to eliminate the Lat Lon data but preserve the grid structure. How can I do this?

    Gamma0_VV   lat         lon         dist       cell
0   0.172325    39.378442   -74.398499  0.003194    0.0             
1   0.101932    39.378459   -74.398385  0.012222    0.0             
2   0.116957    39.378549   -74.398407  0.017423    0.0             
3   0.139411    39.378638   -74.398429  0.025786    0.0             
4   0.134255    39.378728   -74.398451  0.035122    0.0     

I want something of the form:

Gamma0_VV (zeros for simplicity)
[[0, 0, 0, ... 0, 0],
 [0, 0, 0, ... 0, 0],
 [0, 0, 0, ... 0, 0]]

enter image description here

0 Answers
Related