leg_sales_trace

passengersim.database.common_queries.leg_sales_trace(cnx: Database, scenario: str | None = None, burn_samples: int = 100, carrier: str | None = None, leg_id: int | None = None, booking_class: str | None = None, days_prior: int | None = None) DataFrame[source]

Recorded forecast of demand by leg.

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). This function is provided primarily for testing and debugging purposes.

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.

carrier : str, optional

If provided, only return forecasts for this carrier.

leg_id : int, optional

If provided, only return forecasts for this leg.

booking_class : str, optional

If provided, only return forecasts for this booking class.

days_prior : int, optional

If provided, only return forecasts for this many days prior to departure.

Returns:

pandas.DataFrame – The resulting dataframe is indexed by any of carrier, leg_id, booking_class, and/or days_prior that were not filtered, and has these columns: sold, revenue, auth