iduedu.transport_stats

iduedu.transport_stats(urban_graph, *, modes=None)[source]

Stops, routes and stop spacing of every public-transport mode of a graph.

Works on public-transport and intermodal graphs, where the edges between stops and the stop nodes of a mode carry the mode as their type (bus, tram, subway, …).

Parameters:
  • urban_graph (UrbanGraph) – Graph with a type column on nodes and edges.

  • modes (Optional[Iterable[str]]) – Modes to report. By default the edge types that are modes of the transport registry (DEFAULT_REGISTRY_W_TRAIN) or GTFS route types; pass the names of custom modes here.

Return type:

DataFrame

Returns:

DataFrame indexed by mode with columns stop_count (stop nodes of the mode), route_count (distinct values of the edge column route, NaN without it), edge_count, length_km (sum of length_meter, both directions of a route counted), stop_spacing_mean (mean edge length, metres) and speed_kmh (total length over total travel time).

Raises:

KeyError – If nodes or edges have no type column.