I have a dataset that has longitudes and latitudes, and the number of elections a given individual has voted in the elections. My goal is to run a G_Local as I would like to identify the degree of clustering that happens for the number of elections people participated in.
To do this, I started by creating a geometry column with the following code snippet, df_coords = [Point(x, y) for x, y in zip(df['LONGITUDE'], df['LATITUDE'])]
. This work fine.
And so I moved onto the next step which is to set the spatial weights, libpysal.weights.DistanceBand
. Because this required me to only provide the coordinates, without the geom_type, I ran the following code snippet:
newpt = []
lat = df['LATITUDE']
long = df['LONGITUDE']
for item1, item2 in zip(long, lat):
a = (item1, item2)
newpt.append(a)
This too worked fine. The issue begins when I try to execute the weights, w = libpysal.weights.DistanceBand(newpt, threshold = 10)
Whenever I try to execute the weights, my kernel crashes. Without being able to execute the weights, I can't continue onto running G_local.
Please help. Thank you in advance!
I tried lowering the threshold thinking that it may lower the memory requirements but kernel still crashes.