import pandas as pd
from statsmodels.tsa.statespace.sarimax import SARIMAX
df = pd.read_csv('daily_revenue.csv', parse_dates=['date']).set_index('date')
model = SARIMAX(
df['revenue'],
order=(1, 1, 1),
seasonal_order=(1, 1, 1, 7),
enforce_stationarity=False,
enforce_invertibility=False,
)
result = model.fit(disp=False)
forecast = result.get_forecast(steps=14)
print(forecast.predicted_mean)
For many business forecasting tasks, a carefully tuned statistical baseline is still the right first step. SARIMAX makes seasonality, trend, and external regressors explicit, which is useful when stakeholders want understandable drivers. I use it before escalating to more opaque sequence models.