Electric vehicles only (any electric* propulsion), with their type attributes joined.
See Also
filter_vehicles : The general type/propulsion filter.
join_vehicle_types : Resolve the attributes behind the filter.
Examples:
>>> import pandas as pd
>>> vehicles = pd.DataFrame({"bike_id": ["v1", "v2"], "vehicle_type_id": ["t1", "t2"]})
>>> types = pd.DataFrame({
... "vehicle_type_id": ["t1", "t2"], "form_factor": ["bicycle", "bicycle"],
... "propulsion_type": ["human", "electric_assist"]})
>>> ebikes(vehicles, types)["bike_id"].tolist()
['v2']
Source code in src/gbfs_toolkit/analytics/frames.py
| def ebikes(vehicles: pd.DataFrame, vehicle_types: pd.DataFrame) -> pd.DataFrame:
"""Electric vehicles only (any ``electric*`` propulsion), with their type attributes joined.
See Also
--------
[`filter_vehicles`][gbfs_toolkit.filter_vehicles] : The general type/propulsion filter.
[`join_vehicle_types`][gbfs_toolkit.join_vehicle_types] : Resolve the attributes behind the filter.
Examples
--------
>>> import pandas as pd
>>> vehicles = pd.DataFrame({"bike_id": ["v1", "v2"], "vehicle_type_id": ["t1", "t2"]})
>>> types = pd.DataFrame({
... "vehicle_type_id": ["t1", "t2"], "form_factor": ["bicycle", "bicycle"],
... "propulsion_type": ["human", "electric_assist"]})
>>> ebikes(vehicles, types)["bike_id"].tolist()
['v2']
"""
return filter_vehicles(vehicles, vehicle_types, propulsion="electric")
|