As opposed to what's stated in the API docs, passing ids=None to a from_dataframe class method does not pass the df's index as ids.
Here's an MRE:
import libpysal
import geopandas as gpd
from shapely.geometry import box
gdf = gpd.GeoDataFrame(geometry=[box(1, 1, 2, 2), box(2, 1, 3, 2)], index=[1, 2])
w = libpysal.weights.Queen.from_dataframe(gdf)
print(w.id_order)
I don't know if it's the docstrings that haven't been updated after a change or if it's never been implemented, but either way I can open a PR to fix it if that's ok. Implementing it may break some user's code though, so I don't know if there should be some kind of deprecation period before making the change.
I think this is related to https://github.com/pysal/libpysal/issues/474 in that here too the spatial weights class assumes the gdf index is always a default RangeIndex reflecting positional indices
As opposed to what's stated in the API docs, passing
ids=None
to afrom_dataframe
class method does not pass the df's index as ids.Here's an MRE:
I don't know if it's the docstrings that haven't been updated after a change or if it's never been implemented, but either way I can open a PR to fix it if that's ok. Implementing it may break some user's code though, so I don't know if there should be some kind of deprecation period before making the change.