Skip to content
Log inGet startedHugging FaceGitHub

Forecasting

Your data

forecast takes your history as arrays or as a pandas DataFrame. Arrays give arrays back; a DataFrame gives a DataFrame back.

fc = model.forecast(history, h=24)
You pass You get
one series, (T,) (h, Q)
N series of the same length, (N, T) (N, h, Q)
a list of series of different lengths a list, one forecast per series

Q runs over the quantile levels in increasing order (by default 0.1, 0.5 and 0.9; see Ranges). NumPy arrays, torch tensors, pandas Series and plain lists of numbers all work. NaN marks a missing value.

Most data lives in tables. Pass one row per series and timestamp (long format):

fc = model.forecast(df, h=7)
unique_id ds y
store_1 2025-07-01 112
store_1 2025-07-02 98
store_2 2025-07-01 87

The columns are found by name:

  • Series id: unique_id, id, item_id or series_id. Without one, the whole table is one series.
  • Time: ds, timestamp, time, date or datetime.
  • Target: y, target or value, else the one numeric column.

Other names work too: model.forecast(df, h=7, id_col="store", time_col="date", target_col="sales").

The result has the id and time columns, then one column per quantile level: q10, median, q90.

  • The frequency of each series is inferred from its timestamps, or set with freq= (a pandas alias such as "h", "D", "W-SUN" or "15min").
  • Missing timestamps are filled in as missing values, so gaps are fine.
  • Duplicate timestamps in one series are refused with an error that names the series.
  • A pandas Series with a DatetimeIndex is one dated series, and comes back as a DataFrame.

The model reads up to the last 32,768 values of each series; older values are dropped. More history helps it see long seasonal patterns, but a few weeks of hourly data or a year of daily data is often enough.