segmentation_detail_traced¶
-
passengersim.tracers.segmentation.segmentation_detail_traced(source: GenericSimulationTables | CallbackData | pd.DataFrame, *, timeframe: bool =
False, wide: bool =False, markets: Iterable[tuple[str, str] | str] | None =None) pd.DataFrame[source]¶ Get the tracer-based segmentation detail table, optionally reshaped.
- Parameters:
- source : SimulationTables or CallbackData or pd.DataFrame¶
A summary (or its
callback_data) from a simulation that was run with aSegmentationTracerattached, or the raw tracer table.- timeframe : bool, default False¶
If True, convert cumulative values into values within each timeframe, see
cumulative_to_timeframe().- wide : bool, default False¶
If True, pivot segments into columns, named like
sold_businessandrevenue_leisure, and addsoldandrevenuetotal columns.- markets : Iterable[tuple[str, str] | str], optional¶
If given, filter the result to these directional markets.
- Returns:
pd.DataFrame – In long format (default), indexed by
(carrier, orig, dest, booking_class, segment, days_prior)withsoldandrevenuecolumns. In wide format, thesegmentlevel is moved into columns. Values are means per sample, aggregated across all trials.- Raises:
KeyError – If no segmentation tracer data is found in source.