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

A GeoDataFrame containing morphological tessellation.

binsarray, optional

An array of top edges of classification bins. Result of binning.bins.

categoricalbool (default False)

tTeat values as categories (will not use bins).

categorieslist-like (default None)

A 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.