fig_path_forecasts

passengersim.contrast.fig_path_forecasts(summaries: dict[str, SimulationTables], raw_df: bool = False, by_path_id: int | None = None, path_names: dict | None = None, agg_booking_classes: bool = False, by_class: bool | str = True, of: 'mu' | 'sigma' | 'closed' | 'adj_price' | list['mu' | 'sigma' | 'closed' | 'adj_price'] = 'mu', also_df: bool = False) Chart | DataFrame | tuple[Chart, DataFrame][source]

Generate a figure contrasting path demand forecasts for one or more runs.

Parameters:
summaries : dict[str, SimulationTables]

One or more SimulationTables to compare.

raw_df : bool, default False

If True, return the raw DataFrame instead of the chart.

by_path_id : int, optional

If provided, show forecasts only for this specific path ID. If None, the chart is faceted by path ID.

path_names : dict, optional

Mapping from integer path IDs to display labels. If provided, path IDs in the data are replaced with their corresponding labels before plotting.

agg_booking_classes : bool, default False

If True, aggregate (sum or mean, depending on of) across all booking classes before plotting, coloring by source rather than booking class.

by_class : bool or str, default True

If True, differentiate booking classes by color. If a string, filter to only that booking class and color by source instead.

of : {'mu', 'sigma', 'closed', 'adj_price'} or list thereof, default 'mu'

Which forecast statistic to display. Pass a list to display multiple statistics side-by-side.

  • 'mu': mean demand forecast

  • 'sigma': standard deviation of demand forecast

  • 'closed': mean fraction of timeframe the path was closed

  • 'adj_price': mean adjusted fare

also_df : bool, default False

If True, return a tuple of (figure, dataframe) instead of just the figure.

Returns:

alt.Chart or pd.DataFrame or tuple[alt.Chart, pd.DataFrame] – The Altair chart, or the raw DataFrame if raw_df is True, or a (chart, dataframe) tuple if also_df is True.