momepy.Density#

class momepy.Density(gdf, values, spatial_weights, unique_id, areas=None, verbose=True)[source]#

Calculate the gross density.

\[\frac{\sum \text {values}}{\sum \text {areas}}\]

Adapted from [Dibble et al., 2017].

Parameters
gdfGeoDataFrame

A GeoDataFrame containing objects to analyse.

valuesstr, list, np.array, pd.Series

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

spatial_weightslibpysal.weight

A spatial weights matrix.

unique_idstr

The name of the column with unique ID used as spatial_weights index

areasstr, list, np.array, pd.Series (optional)

The name of the dataframe column, np.array, or pd.Series where area values are stored. If None, gdf.geometry.area will be used.

verbosebool (default True)

If True, shows progress bars in loops and indication of steps.

Examples

>>> tessellation_df['floor_area_dens'] = mm.Density(tessellation_df,
...                                                 'floor_area',
...                                                 sw,
...                                                 'uID').series
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.

areasSeries

A Series containing used area values.

__init__(gdf, values, spatial_weights, unique_id, areas=None, verbose=True)[source]#

Methods

__init__(gdf, values, spatial_weights, unique_id)