-
Notifications
You must be signed in to change notification settings - Fork 82
Description
roundtripping a W
through an adjacency list will create a valid but re-ordered matrix. That is, all the relationships are preserved with the proper weights, but the ordering of the keys may be different from the index of the dataframe it was created from. In general thats not a problem because all of the internal logic of the W still works fine.
But creating a spatial lag from a combo like this (where W and dataframe are paired but in different orders) will generate a series of values that no longer match the df. A simple fix (and a useful enhancement more broadly) would be to add a kwarg to lag_spatial
that optionally returns a pandas series indexed on W.neighbors.keys
. Should make things a little easier and more explicit without breaking backwards compat