From 9b844b16e777ef643ea20f93f9fe415ecc51ff20 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Mon, 30 Nov 2026 20:03:25 +0100 Subject: [PATCH] Import `statsmodels.tsa.api` as `tsa` The alias in the `statsmodels` documentation --- pyproject.toml | 1 + src/velofy/forecasts/methods/extrapolate_season.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 34e32ad..30157e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -552,6 +552,7 @@ banned-from = [ "sqlalchemy" = "sa" "sqlalchemy.dialects.postgresql" = "psql" "sqlalchemy.ext.hybrid" = "sa_hybrid" +"statsmodels.tsa.api" = "tsa" "typing" = "t" diff --git a/src/velofy/forecasts/methods/extrapolate_season.py b/src/velofy/forecasts/methods/extrapolate_season.py index a6ea8f6..7d70af7 100644 --- a/src/velofy/forecasts/methods/extrapolate_season.py +++ b/src/velofy/forecasts/methods/extrapolate_season.py @@ -1,7 +1,7 @@ """Forecast by linear extrapolation of a seasonal component.""" import pandas as pd -from statsmodels.tsa import api as ts_stats +from statsmodels.tsa import api as tsa def predict( @@ -46,7 +46,7 @@ def predict( # Obtain all `observations` of the same seasonal lag and # fit a straight line through them (= `trend`). observations = training_ts[slice(lag, 999_999_999, frequency)] - trend = observations - ts_stats.detrend(observations) + trend = observations - tsa.detrend(observations) # Create a point forecast by linear extrapolation # for one or even more time steps ahead.