momepy.
Simpson
Calculates the Simpson’s diversity index of values within neighbours defined in spatial_weights.
spatial_weights
Uses mapclassify.classifiers under the hood for binning. Requires mapclassify>=.2.1.0 dependency.
mapclassify.classifiers
mapclassify>=.2.1.0
Adapted from [Fel18].
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 - If None, Queen contiguity matrix of set order will be calculated based on objects.
name of the column with unique id used as spatial_weights index
One of mapclassify classification schemes. For details see mapclassify API documentation.
return Gini-Simpson index instead of Simpson index (1 - λ)
1 - λ
return Inverse Simpson index instead of Simpson index (1 / λ)
1 / λ
treat values as categories (will not use binning)
binning
list of categories. If None values.unique() is used.
values.unique()
if True, shows progress bars in loops and indication of steps
Keyword arguments for classification scheme For details see mapclassify documentation.
See also
momepy.simpson_diversity
Calculates the Simpson’s diversity index of data
Examples
>>> sw = momepy.sw_high(k=3, gdf=tessellation_df, ids='uID') >>> tessellation_df['area_Simpson'] = mm.Simpson(tessellation_df, 'area', sw, 'uID').series 100%|██████████| 144/144 [00:00<00:00, 455.83it/s]
Series containing resulting values
original GeoDataFrame
Series containing used values
spatial weights matrix
Series containing used unique ID
binning method
generated bins
classification_kwds
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(gdf, values, spatial_weights, unique_id)
Initialize self.