I have the following in a pandas dataframe:
z | x | y | hash
_________________
a | 0.0 | 1.0 | abcd
b | 1.0 | 1.0 | efghj
c | 1.0 | 0.0 | iklmno
d | 0.0 | 0.0 | pqrs
(Where Z represents digital elevation, x and y are lat, long, and hash is a geohash)
In order to find the nearest n geohash locations, I would like to convert it into a 2d numpy array such that the location is preserved in the structure of the array:
[["pqrs","abcd"],
["iklmno","efghj"]]
The original data frame is over 2,000,000 entries long, and is the result of geohashing a raster that has a shape of (7875, 14644).
There was some information lost in the geohashing process, so I cannot simply convert the data frame to a numpy array and use numpy.reshape()
. I have tried solutions involving numpy.meshgrid()
(as detailed Here), but my system does not have enough memory to hold the meshgrid objects.
I have also tried rasterizing the dataframe using "r", but this crashed my system.
Any advice would be enormously helpful! Thank you SO community