cumulative_to_timeframe¶
- passengersim.tracers.segmentation.cumulative_to_timeframe(df: DataFrame) DataFrame[source]¶
Convert cumulative-through-DCP values into values within each timeframe.
- Parameters:
- df : pd.DataFrame¶
A table indexed with
days_prioras its last level, holding cumulative values (from the start of the booking horizon through each DCP), such as the output ofSegmentationTracer.finalize().
- Returns:
pd.DataFrame – Same index levels, where each row’s
days_priorlabels the start of a timeframe, and values are the amounts booked from that DCP up to the next DCP (closer to departure). The final DCP (normally 0, departure) starts no timeframe and is dropped. This matches the convention used bySimTabSegmentationDetail.fig_segmentation_detail().