TimeSeriesPredictor.make_future_data_frame

TimeSeriesPredictor.make_future_data_frame(data: TimeSeriesDataFrame | DataFrame | Path | str) DataFrame[source]

Generate a dataframe with the item_id and timestamp values corresponding to the forecast horizon.

Parameters:

data (Union[TimeSeriesDataFrame, pd.DataFrame, Path, str]) – Historical time series data.

Returns:

forecast_horizon – Data frame with columns item_id and timestamp corresponding to the forecast horizon. For each item ID in data, forecast_horizon will contain the timestamps for the next prediction_length time steps, following the end of each series in the input data.

Return type:

pd.DataFrame

Examples

>>> print(data)
                    target
item_id timestamp
A       2024-01-01       0
        2024-01-02       1
        2024-01-03       2
B       2024-04-07       3
        2024-04-08       4
>>> predictor = TimeSeriesPredictor(prediction_length=2, freq="D")
>>> print(predictor.make_future_data_frame(data))
  item_id  timestamp
0       A 2024-01-04
0       A 2024-01-05
1       B 2024-04-09
1       B 2024-04-10