Calculate the number of neighbours captured by spatial_weights
If weighted=True, number of neighbours will be divided by the perimeter of object
to return relative value.
Adapted from [HRRCambraLopez12].
GeoDataFrame containing objects to analyse
spatial weights matrix
name of the column with unique id used as spatial_weights index
if True, number of neighbours will be divided by the perimeter of object, to return relative value
if True, shows progress bars in loops and indication of steps
>>> sw = libpysal.weights.contiguity.Queen.from_dataframe(tessellation_df, ids='uID')
>>> tessellation_df['neighbours'] = momepy.Neighbors(tessellation_df, sw, 'uID').series
100%|██████████| 144/144 [00:00<00:00, 6909.50it/s]
Series containing resulting values
Series containing used values
Series containing used unique ID
used weighted value
Initialize self. See help(type(self)) for accurate signature.
__init__(gdf, spatial_weights, unique_id[, …])