Skip to content

Rook & KNN take different id lists from the dataframe #102

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

Open
ljwolf opened this issue Aug 17, 2018 · 3 comments
Open

Rook & KNN take different id lists from the dataframe #102

ljwolf opened this issue Aug 17, 2018 · 3 comments
Labels
needs testing a pull request which needs testing added, or a bug/rough edge which exposes a functional testing gap no-issue-activity rough edge Something that's not a bug, but that gets in the way of "it just works." weights
Milestone

Comments

@ljwolf
Copy link
Member

ljwolf commented Aug 17, 2018

KNN correctly takes the index of the dataframe as the index of the weights, but rook does not.

from libpysal import weights
from libpysal import examples
import geopandas

columbus = geopandas.read_file(examples.get_path('columbus.shp'))
columbus_sub = columbus.sample(frac=1)

print(columbus_sub.index[0:5]) # should not be (0,1,2,3,4,) but instead random

Wr = weights.Rook.from_dataframe(columbus_sub)
Wknn1 = weights.KNN.from_dataframe(columbus_sub)

print(Wr.id_order) # is (0,1,2,3...)
print(Wknn1.id_order) # matches columbus_sub.index

These should behave the same everywhere, and I think they should behave like KNN, taking the indices from the dataframe directly.

@ljwolf ljwolf added the rough edge Something that's not a bug, but that gets in the way of "it just works." label Aug 17, 2018
@ljwolf
Copy link
Member Author

ljwolf commented Aug 17, 2018

I thought this was sorted earlier, but I may not be clear on what was and was not successfully ported from pysal. Regardless, that this was addressed somewhere more than once means we probably should finish the repackaging 😄

@ljwolf ljwolf added the needs testing a pull request which needs testing added, or a bug/rough edge which exposes a functional testing gap label Aug 17, 2018
@ljwolf ljwolf added this to the next milestone Sep 9, 2019
@ljwolf
Copy link
Member Author

ljwolf commented Jan 4, 2020

This is also related to #184 since, again, this is a product of ids, sorting, & propagation of ids, id_order, and idVariable.

@github-actions
Copy link

github-actions bot commented Mar 5, 2020

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing a pull request which needs testing added, or a bug/rough edge which exposes a functional testing gap no-issue-activity rough edge Something that's not a bug, but that gets in the way of "it just works." weights
Projects
None yet
Development

No branches or pull requests

2 participants