Documentation Index
Fetch the complete documentation index at: https://nixtlaverse.nixtla.io/llms.txt
Use this file to discover all available pages before exploring further.
fourier
fourier(df, freq, season_length, k, h=0, id_col='unique_id', time_col='ds')
Compute fourier seasonal terms for training and forecasting
Parameters:
| Name | Type | Description | Default |
|---|
df | pandas or polars DataFrame | Dataframe with ids, times and values for the exogenous regressors. | required |
freq | str or int | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | required |
season_length | int | Number of observations per unit of time. Ex: 24 Hourly data. | required |
k | int | Maximum order of the fourier terms | required |
h | int | Forecast horizon. Defaults to 0. | 0 |
id_col | str | Column that identifies each serie. Defaults to ‘unique_id’. | ‘unique_id’ |
time_col | str | Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’. | ‘ds’ |
Returns:
| Type | Description |
|---|
Tuple[DFType, DFType] | tuple[pandas or polars DataFrame, pandas or polars DataFrame]: A tuple containing the original DataFrame with the computed features and DataFrame with future values. |
trend
trend(df, freq, h=0, id_col='unique_id', time_col='ds')
Add a trend column with consecutive integers for training and forecasting
Parameters:
| Name | Type | Description | Default |
|---|
df | pandas or polars DataFrame | Dataframe with ids, times and values for the exogenous regressors. | required |
freq | str or int | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | required |
h | int | Forecast horizon. Defaults to 0. | 0 |
id_col | str | Column that identifies each serie. Defaults to ‘unique_id’. | ‘unique_id’ |
time_col | str | Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’. | ‘ds’ |
Returns:
| Type | Description |
|---|
Tuple[DFType, DFType] | tuple[pandas or polars DataFrame, pandas or polars DataFrame]: A tuple containing the original DataFrame with the computed features and DataFrame with future values. |
time_features
time_features(df, freq, features, h=0, id_col='unique_id', time_col='ds')
Compute timestamp-based features for training and forecasting
Parameters:
| Name | Type | Description | Default |
|---|
df | pandas or polars DataFrame | Dataframe with ids, times and values for the exogenous regressors. | required |
freq | str or int | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | required |
features | list of str or callable | Features to compute. Can be string aliases of timestamp attributes or functions to apply to the times. | required |
h | int | Forecast horizon. Defaults to 0. | 0 |
id_col | str | Column that identifies each serie. Defaults to ‘unique_id’. | ‘unique_id’ |
time_col | str | Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’. | ‘ds’ |
Returns:
| Type | Description |
|---|
Tuple[DFType, DFType] | tuple[pandas or polars DataFrame, pandas or polars DataFrame]: A tuple containing the original DataFrame with the computed features and DataFrame with future values. |
future_exog_to_historic
future_exog_to_historic(df, freq, features, h=0, id_col='unique_id', time_col='ds')
Turn future exogenous features into historic by shifting them h steps.
Parameters:
| Name | Type | Description | Default |
|---|
df | pandas or polars DataFrame | Dataframe with ids, times and values for the exogenous regressors. | required |
freq | str or int | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | required |
features | list of str | Features to be converted into historic. | required |
h | int | Forecast horizon. Defaults to 0. | 0 |
id_col | str | Column that identifies each serie. Defaults to ‘unique_id’. | ‘unique_id’ |
time_col | str | Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’. | ‘ds’ |
Returns:
| Type | Description |
|---|
Tuple[DFType, DFType] | tuple[pandas or polars DataFrame, pandas or polars DataFrame]: A tuple containing the original DataFrame with the computed features and DataFrame with future values. |
pipeline
pipeline(df, features, freq, h=0, id_col='unique_id', time_col='ds')
Compute several features for training and forecasting
Parameters:
| Name | Type | Description | Default |
|---|
df | pandas or polars DataFrame | Dataframe with ids, times and values for the exogenous regressors. | required |
features | list of callable | List of features to compute. Must take only df, freq, h, id_col and time_col (other arguments must be fixed). | required |
freq | str or int | Frequency of the data. Must be a valid pandas or polars offset alias, or an integer. | required |
h | int | Forecast horizon. Defaults to 0. | 0 |
id_col | str | Column that identifies each serie. Defaults to ‘unique_id’. | ‘unique_id’ |
time_col | str | Column that identifies each timestep, its values can be timestamps or integers. Defaults to ‘ds’. | ‘ds’ |
Returns:
| Type | Description |
|---|
Tuple[DFType, DFType] | tuple[pandas or polars DataFrame, pandas or polars DataFrame]: A tuple containing the original DataFrame with the computed features and DataFrame with future values. |