The analysis-ready subset: stations that pass the static A1–A7 audit, in one call.
Shorthand for running audit_static and keeping the unflagged rows: the first thing
most studies do before anything else.
See Also
audit_static : The audit whose flagged column this filters on.
audit_frames : Run the static and dynamic audits and stack their verdicts.
Examples:
The car-sharing station (A1) is dropped; the docked station survives:
>>> import pandas as pd
>>> stations = pd.DataFrame({
... "system_id": "s", "station_id": ["a", "b"],
... "station_type": ["docked_bike", "carsharing"],
... "capacity": [20, 5], "lat": [48.85, 48.86], "lon": [2.35, 2.36],
... })
>>> drop_flagged(stations)["station_id"].tolist()
['a']
Source code in src/gbfs_toolkit/audit/__init__.py
| def drop_flagged(stations: pd.DataFrame) -> pd.DataFrame:
"""The analysis-ready subset: stations that pass the static A1–A7 audit, in one call.
Shorthand for running [`audit_static`][gbfs_toolkit.audit_static] and keeping the unflagged rows: the first thing
most studies do before anything else.
See Also
--------
[`audit_static`][gbfs_toolkit.audit_static] : The audit whose ``flagged`` column this filters on.
[`audit_frames`][gbfs_toolkit.audit_frames] : Run the static and dynamic audits and stack their verdicts.
Examples
--------
The car-sharing station (A1) is dropped; the docked station survives:
>>> import pandas as pd
>>> stations = pd.DataFrame({
... "system_id": "s", "station_id": ["a", "b"],
... "station_type": ["docked_bike", "carsharing"],
... "capacity": [20, 5], "lat": [48.85, 48.86], "lon": [2.35, 2.36],
... })
>>> drop_flagged(stations)["station_id"].tolist()
['a']
"""
verdict = audit_static(stations)
return stations[~verdict["flagged"].to_numpy()].reset_index(drop=True)
|