segment_metric_table

passengersim.tracers.segmentation.segment_metric_table(source: GenericSimulationTables | CallbackData | pd.DataFrame, metric: 'bookings' | 'revenue' = 'bookings') → pd.DataFrame[source]

Get cumulative values of one metric with segments as columns.

This is the shape consumed by the segmentation detail figures.

Parameters:
source : SimulationTables or CallbackData or pd.DataFrame

See segmentation_detail_traced().

metric : {"bookings", "revenue"}, default "bookings"

Which metric to return.

Returns:

pd.DataFrame – Indexed by (carrier, orig, dest, booking_class, days_prior) with one column per segment, holding mean cumulative values per sample.