leg_forecasts

passengersim.database.common_queries.leg_forecasts(cnx: Database, *, scenario: str = None, burn_samples: int = 100) DataFrame[source]

Average forecasts of demand by leg, bucket, and days to departure.

This query requires that the simulation was run while recording leg bucket details (i.e. with the bucket flag set on Config.db.write_items).

Parameters:
cnx : Database

scenario : str

burn_samples : int, default 100

The forecasts will be analyzed ignoring this many samples from the beginning of each trial.

Returns:

pandas.DataFrame – The resulting dataframe is indexed by carrier, leg_id, bucket_number, booking_class and days_prior, and has these columns:

  • forecast_mean: Average forecast mean (mu).

  • forecast_stdev: Average forecast standard deviation (sigma).

  • forecast_closed_in_tf: Average fraction of time the timeframe was

    closed in the data used to make a forecast.

  • forecast_closed_in_tf: Average fraction of time any future timeframe

    was closed in the data used to make a forecast.