momepy.Range

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

Calculates the range of values within neighbours defined in spatial_weights.

Uses scipy.stats.iqr under the hood.

\[\]
Parameters:
gdf : GeoDataFrame

GeoDataFrame containing morphological tessellation

values : str, list, np.array, pd.Series

the name of the dataframe column, np.array, or pd.Series where is stored character value.

spatial_weights : libpysal.weights

spatial weights matrix

unique_id : str

name of the column with unique id used as spatial_weights index

rng : Two-element sequence containing floats in range of [0,100], optional

Percentiles over which to compute the range. Each must be between 0 and 100, inclusive. The order of the elements is not important.

**kwargs : keyword arguments

optional arguments for scipy.stats.iqr

References

Dibble J, Prelorendjos A, Romice O, et al. (2017) On the origin of spaces: Morphometric foundations of urban form evolution. Environment and Planning B: Urban Analytics and City Science 46(4): 707–730.

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:
series : Series

Series containing resulting values

gdf : GeoDataFrame

original GeoDataFrame

values : Series

Series containing used values

sw : libpysal.weights

spatial weights matrix

id : Series

Series containing used unique ID

rng : tuple

range

kwargs : dict

kwargs

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

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, gdf, values, spatial_weights, …) Initialize self.