Open
Description
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.