-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting an error while trying to calculate knn weights from dataframe #441
Comments
@revanthApricelabs can you share the data? It would help a lot when debugging this! |
Updated the file. Let me know if you have any issues with it |
i think this is usually related to a mismatched index between the df and the weights constructor. Try setting either the if thats indeed the root cause, this has been a pain point for a while and should be addressed by some changes we have planned for the library's internals |
Nope still getting same issues even after setting either the ids or id_order arguments.
to
|
I can confirm the issue, using the following snippet. It doesn't even matter which distance metric is used. I'll explore the cause. df = pandas.read_csv("sample_file.csv")
df = geopandas.GeoDataFrame(df, geometry=geopandas.GeoSeries.from_wkt(df.geo_polygon), crs=4326)
w = libpysal.weights.KNN.from_dataframe(df, k=50) |
I think this is related to coincident points! (e.g. #164, pysal#941 and I think five others). We're expecting the |
Hey .Im using python 3.8.10,pysal 2.5,scipy 1.7.1,numpy 1.20.0 on wsl2 in windows 11.
I am getting the following error while trying to compute knn weights :
It worked on other datafiles but keeps failing on this particular dataset.
Also the distance_metric for the KNN.from_dataframe function should be 'arc' in the tutorials containing geopandas dataframes
sample_file.csv
The text was updated successfully, but these errors were encountered: