detect_frozen_stations¶
detect_frozen_stations
¶
detect_frozen_stations(panel: DataFrame, *, value_col: str = 'num_bikes_available', columns: tuple[str, ...] | None = None, min_run_hours: float = 6.0, active_hours: tuple[int, int] | None = (6, 22), strict: bool = False) -> DataFrame
Flag "frozen" stations: a value stuck unchanged while the feed keeps updating.
Distinct from staleness (D3, where last_reported itself goes stale) and from a genuine
stockout: here the feed is fresh but the value never moves, the signature of a dead sensor
or a station the operator forgot. Restricting to active_hours (local hour of
fetched_at as stored) avoids flagging the legitimate overnight flatline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value_col
|
str
|
The column expected to vary (used when |
"num_bikes_available"
|
columns
|
tuple of str
|
Require all these columns to be frozen, e.g. |
None
|
min_run_hours
|
float
|
Minimum span (of an unchanged run, or of the whole series in |
6
|
active_hours
|
(int, int) or None
|
Keep only observations in |
(6, 22)
|
strict
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Indexed by |
See Also
stockout_episodes : Genuine outage episodes.
Source code in src/gbfs_toolkit/io/timeseries.py
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 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |