sw_high(k, gdf=None, weights=None, ids=None, contiguity='queen', silent=True)¶
Generate spatial weights based on Queen or Rook contiguity of order k.
Adjacent are all features within <= k steps. Pass either
weights. If both are passed,
weightsis used. If
contiguityis ignored and high order spatial weights based on
order of contiguity
GeoDataFrame containing objects to analyse. Index has to be consecutive range
0:x. Otherwise, spatial weights will not match objects.
libpysal.weights of order 1
- contiguitystr (default ‘queen’)
type of contiguity weights. Can be
- silentbool (default True)
silence libpysal islands warnings
>>> first_order = libpysal.weights.Queen.from_dataframe(geodataframe) >>> first_order.mean_neighbors 5.848032564450475 >>> fourth_order = sw_high(k=4, gdf=geodataframe) >>> fourth.mean_neighbors 85.73188602442333