StatsForecast is a Python library providing a lightning-fast suite of statistical and econometric models for time series forecasting. It offers highly optimized implementations of models like ARIMA, ETS, CES, and Theta, designed for speed and scalability to forecast millions of series efficiently. The library is currently at version 2.0.3 and maintains an active release cadence with frequent updates and performance enhancements.
pip install statsforecastVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use StatsForecast to fit an AutoARIMA model to the classic AirPassengers dataset and generate future predictions with confidence intervals. The input DataFrame must be in a 'long' format with 'unique_id', 'ds' (datestamp), and 'y' (target) columns.
Explicitly set `allowmean=False` and/or `allowdrift=False` in `AutoARIMA` constructor if you need the old behavior, or review your models to account for the new defaults.
Remove the `df` argument from the `StatsForecast()` constructor. Pass your DataFrame directly to methods like `sf.fit(df)` or `sf.forecast(df=df, h=...)`.
Replace `freq='H'` with `freq='h'` when defining the frequency in `StatsForecast` or other pandas-related operations.
Consult the official release notes for v2.0.0 and update code using features that were marked as deprecated in earlier versions.
Rename your DataFrame columns to 'unique_id', 'ds', and 'y' as required by the library, ensuring 'ds' is a datetime type and 'y' is numeric.
Example: `df.rename(columns={'series_id': 'unique_id', 'timestamp': 'ds', 'sales': 'y'}, inplace=True)`Import the models from `statsforecast.models` instead of `statsforecast`. Example: `from statsforecast.models import ARIMA`
Update the import statement to get `StatsForecast` directly from the top-level package. Example: `from statsforecast import StatsForecast`
Explicitly set `n_jobs=1` in the `StatsForecast` constructor to disable parallel processing, or `n_jobs=-1` to instruct it to use all detected cores if the issue is with detection. Example: `sf = StatsForecast(models=[ARIMA(season_length=1)], freq='D', n_jobs=1)`
Use a valid Pandas frequency string for the `freq` parameter. Common values include 'D', 'H', 'M', 'W', 'Q', 'Y'. Example: `sf = StatsForecast(models=[ARIMA(season_length=7)], freq='D')`