iduedu.diversity¶
- iduedu.diversity(urban_graph, cutoff, category, *, gdf_objects, gdf_origins=None, origins_nodes=None, values=None, hill_order=2.0, weight='time_min', decay=None, beta=None, direction='from', graph_node_column='graph_node_id', max_workers=None)[source]¶
Diversity of object categories within a travel cost of every origin.
The shares
pof the categories are taken from the object counts in reach (or from the sums ofvalues, for example floor area), weighted bydecaywhen it is set.- Parameters:
urban_graph (
UrbanGraph) – Graph to search.cutoff (
Union[float,Iterable[float]]) – Largest travel cost, inclusive, or several of them.category (
str) – Column ofgdf_objectswith the category of every object. Objects without one are left out.gdf_objects (
DataFrame) – Objects, withgraph_node_columnor matched to their nearest nodes.gdf_origins (
DataFrame|None) – Origin objects, with the same conventions, orvalues (
str|None) – Numeric column ofgdf_objectsthat weighs the objects instead of counting them.hill_order (
float) – Orderqof the Hill number: 0 counts categories, 1 givesexpof the Shannon entropy, 2 (the default) the inverse Simpson index.weight (
Literal['length_meter','time_min']) – Edge cost column:time_min(minutes) orlength_meter(metres).decay (
Optional[Literal['linear','exp','inverse']]) – Distance decay, seeaggregate_objects().beta (
Union[float,Iterable[float],None]) – Rate of the exponential decay, seeaggregate_objects().direction (
Literal['from','to']) –"from"(origin to object) or"to"(object to origin).graph_node_column (
str) – Column of object tables that holds graph node ids.max_workers (
int|None) – Number of threads;Noneuses all cores.
- Returns:
richness_c(categories in reach),shannon_c(entropy-Σ p ln p) andhill_c(effective number of categories of orderhill_order);NaNfor the last two where nothing is in reach.- Return type:
DataFrame indexed like the origins. For every cutoff
c- Raises:
KeyError – If
categoryorvaluesis absent fromgdf_objects.ValueError – If
hill_orderis negative or other arguments are invalid.