momepy.shannon_diversity

momepy.shannon_diversity(data, bins=None, categorical=False, categories=None)[source]

Calculates the Shannon’s diversity index of data. Helper function for momepy.Shannon.

\[\lambda=\sum_{i=1}^{R} p_{i}^{2}\]

Formula adapted from https://gist.github.com/audy/783125

Parameters
dataGeoDataFrame

GeoDataFrame containing morphological tessellation

binsarray, optional

array of top edges of classification bins. Result of binnng.bins.

categoricalbool (default False)

treat values as categories (will not use bins)

categorieslist-like (default None)

list of categories

Returns
float

Shannon’s diversity index

See also

momepy.Shannon

Calculates the Shannon’s diversity index

momepy.Simpson

Calculates the Simpson’s diversity index

momepy.simpson_diversity

Calculates the Simpson’s diversity index