Ashesh Das
Ashesh Das

Reputation: 365

How to forecast for future dates using time series forecasting in Python?

I am new to time series forecasting and have made the following model:

df = pd.read_csv('timeseries_data.csv', index_col="Month")

# ARMA
from statsmodels.tsa.arima_model import ARMA
from random import random
# contrived dataset
data = df
# fit model
model = ARMA(data, order=(2, 1))
model_fit = model.fit(disp=False)
# make prediction
yhat = model_fit.predict()
print(yhat)

The above code predicts for the data points in df. But what should I do if I want to predict for some future date? For example: For the entire year of 2022?

Upvotes: 2

Views: 6581

Answers (1)

Ashesh Das
Ashesh Das

Reputation: 365

I found the solution, it was actually very simple:

arma_df = model_fit.predict(start='2020-01-01', end='2023-12-01')

Upvotes: 2

Related Questions