momepy.Range#

class momepy.Range(gdf, values, spatial_weights, unique_id, rng=(0, 100), verbose=True, **kwargs)[source]#

Calculates the range of values within neighbours defined in spatial_weights. Uses scipy.stats.iqr under the hood.

Adapted from [Dibble et al., 2017].

Parameters:
gdfGeoDataFrame

A GeoDataFrame containing morphological tessellation.

valuesstr, list, np.array, pd.Series

The name of the dataframe column, np.array, or pd.Series where character values are stored.

spatial_weightslibpysal.weights

A spatial weights matrix.

unique_idstr

The name of the column with unique IDs used as the spatial_weights index.

rngtuple, list, optional (default None)

A two-element sequence containing floats between 0 and 100 (inclusive) that are the percentiles over which to compute the range. The order of the elements is not important.

**kwargsdict

Optional arguments for scipy.stats.iqr.

verbosebool (default True)

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['area_IQR_3steps'] = mm.Range(tessellation_df,
...                                               'area',
...                                               sw,
...                                               'uID',
...                                               rng=(25, 75)).series
100%|██████████| 144/144 [00:00<00:00, 722.50it/s]
Attributes:
seriesSeries

A Series containing resulting values.

gdfGeoDataFrame

The original GeoDataFrame.

valuesSeries

A Series containing used values.

swlibpysal.weights

The spatial weights matrix.

idSeries

A Series containing used unique ID.

rngtuple, list, optional (default None)

A two-element sequence containing floats between 0 and 100 (inclusive) that are the percentiles over which to compute the range. The order of the elements is not important.

kwargsdict

Optional arguments for scipy.stats.iqr.

__init__(gdf, values, spatial_weights, unique_id, rng=(0, 100), verbose=True, **kwargs)[source]#

Methods

__init__(gdf, values, spatial_weights, unique_id)