Description
When running:
local_geary = Geary_Local(spatial_weights)
local_geary_contiguity_ratio = local_geary.fit(x)
The order of values in local_geary_contiguity_ratio
does not correspond to the order of values in the input array x
.
The loss of order occurs at line 167 in local_geary.py:
adj_list_gs = adj_list_gs.groupby(by="ID").sum()
The groupby function returns the values in the lexicographic order of the weight id's. While the spatial weights class W stores data in lexicographic order by default, a user may impose a different ordering by setting the id_order parameter. In this case, the order in the localG attribute is different from the input, which is quite misleading and frankly speaking a bug.
It would be quite useful for the fit function to return the values in same order as the spatial weights. If you chose not to do it, please indicate in the documentation that the order of values in the localG attribute may change and is the lexicographic order of the spatial weights and not the order of the input.