boundary_stress¶
boundary_stress
¶
Per-station share of time near empty or near full, not just at the boundary.
A user reads a station with two bikes left as unreliable (they may be the broken
ones), long before it hits zero; station_outage_rates (strictly == 0)
undercounts that perceived stress. This reports the fraction of observations with
at most bikes_le bikes (pick-up stress) and at most docks_le docks
(drop-off stress), using absolute thresholds, since two bikes mean stress at a
10-dock station but not at a 40-dock one. Drop-off stress is undefined for
free-floating or zero-capacity stations (no physical docks), so it returns NA
there rather than a misleading number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
panel
|
DataFrame
|
Panel or snapshots with |
required |
bikes_le
|
int
|
A station is under pick-up / drop-off stress when its bikes / docks are at or below this absolute count. |
2
|
docks_le
|
int
|
A station is under pick-up / drop-off stress when its bikes / docks are at or below this absolute count. |
2
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
See Also
station_outage_rates : The strict empty/full (== 0) rates.
censored_time_ratio : Share of demand lost at the boundary.
service_reliability_index : Level-of-service probabilities.
Examples:
>>> import pandas as pd
>>> panel = pd.DataFrame({
... "system_id": "s", "station_id": "a",
... "num_bikes_available": [0, 1, 5, 10],
... "num_docks_available": [10, 9, 5, 0],
... })
>>> float(boundary_stress(panel)["pickup_stress_ratio"].iloc[0])
0.5
Source code in src/gbfs_toolkit/analytics/service.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | |