momepy.
Percentiles
Calculates the percentiles of values within neighbours defined in spatial_weights.
spatial_weights
GeoDataFrame containing morphological tessellation
the name of the dataframe column, np.array, or pd.Series where is stored character value.
np.array
pd.Series
spatial weights matrix
name of the column with unique id used as spatial_weights index
percentiles to return
This optional parameter specifies the interpolation method to use when the desired percentile lies between two data points i < j:
i < j
'linear'
'lower'
'higher'
'nearest'
'midpoint'
See the documentation of numpy.percentile for details.
numpy.percentile
if True, shows progress bars in loops and indication of steps
Examples
>>> sw = momepy.sw_high(k=3, gdf=tessellation_df, ids='uID') >>> tessellation_df['cluster_unique'] = mm.Percentiles(tessellation_df, 'cluster', sw, 'uID').frame 100%|██████████| 144/144 [00:00<00:00, 722.50it/s]
DataFrame containing resulting values
original GeoDataFrame
Series containing used values
Series containing used unique ID
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(gdf, values, spatial_weights, unique_id)
Initialize self.