dynamic_gini_index¶
dynamic_gini_index
¶
dynamic_gini_index(panel: DataFrame, *, value_col: str = 'num_bikes_available', time_col: str = 'fetched_at', target_col: str | None = None) -> DataFrame
Gini coefficient of available bikes across stations, as a time series.
Capacity-based concentration (see concentration_metrics) measures a network's static
design. This measures the dynamic inequality of where the bikes actually are: a system with
evenly distributed capacity can still become deeply unequal at 18:00, when the fleet piles into
one district. A rising curve over the day objectifies that loss of equity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
panel
|
DataFrame
|
From |
required |
value_col
|
str
|
The per-station quantity whose distribution is measured. |
"num_bikes_available"
|
time_col
|
str
|
Snapshot timestamp. |
"fetched_at"
|
target_col
|
str
|
Deprecated alias for |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
See Also
concentration_metrics : Static capacity concentration.
temporal_concentration : The temporal (per-station) analogue.
theil_index : A decomposable inequality scalar.
Examples:
>>> import pandas as pd
>>> panel = pd.DataFrame({
... "station_id": ["a", "b", "a", "b"],
... "fetched_at": pd.to_datetime(
... ["2026-01-01T08:00Z"] * 2 + ["2026-01-01T18:00Z"] * 2),
... "num_bikes_available": [5, 5, 10, 0],
... })
>>> out = dynamic_gini_index(panel)
>>> bool(out["gini"].iloc[0] < out["gini"].iloc[1])
True