fig_demand_to_come

passengersim.contrast.fig_demand_to_come(summaries: Contrast, func: 'mean' | 'std' | list['mean' | 'std'] = 'mean', *, raw_df: bool = False, title: str | None = 'Demand to Come', also_df: bool = False) Chart | DataFrame | tuple[Chart, DataFrame][source]

Generate a figure contrasting demand-to-come curves for one or more runs.

Demand to come is the expected remaining demand (i.e., future bookings) at each days-prior-to-departure snapshot, broken out by passenger segment. This figure plots those curves across multiple simulation runs for easy comparison.

Parameters:
summaries : Contrast

A Contrast containing the simulation results to compare.

func : {'mean', 'std'} or list thereof, default 'mean'

Which statistic to display: 'mean' for mean demand to come or 'std' for standard deviation. Pass a list to display both side-by-side.

raw_df : bool, default False

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

title : str, optional

Chart title. Defaults to "Demand to Come". Pass None for no title.

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.

Raises:

ValueError – If func is not 'mean', 'std', or a list containing those values.