service_reliability_index¶
service_reliability_index
¶
service_reliability_index(panel: DataFrame, *, freq: str = '1h', min_bikes: int = 1, min_docks: int = 1) -> DataFrame
Empirical level-of-service probability per station and time-of-day.
For each station and each time-of-day bucket (width freq), the fraction of observations
with at least min_bikes bikes, with at least min_docks docks, and with both at once.
This is the service view a mode-shift study needs ("can a user find a bike and a dock at
08:00?"), which an availability mean hides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
panel
|
DataFrame
|
From |
required |
freq
|
str
|
Fixed time-of-day bucket width (a pandas offset alias such as |
"1h"
|
min_bikes
|
int
|
Availability thresholds for "service available". |
1
|
min_docks
|
int
|
Availability thresholds for "service available". |
1
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
References
Vogel, Greiser and Mattfeld (2011), Understanding bike-sharing systems using data mining.
See Also
station_outage_rates : Time-share empty/full per station.
censored_time_ratio : Share of demand lost to saturation.
capacity_utilization : Normalise availability by capacity first.
Examples:
>>> import pandas as pd
>>> panel = pd.DataFrame({
... "system_id": "s", "station_id": "a",
... "fetched_at": pd.to_datetime(["2026-01-01T08:00Z", "2026-01-08T08:00Z"]),
... "num_bikes_available": [5, 0], "num_docks_available": [5, 10],
... })
>>> float(service_reliability_index(panel)["prob_bikes_avail"].iloc[0])
0.5
Source code in src/gbfs_toolkit/analytics/service.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |