0

Here's the code using statsmodels.tsa.arima.model.Arima model to predict the store sales

from statsmodels.tsa.arima.model import ARIMA
from datetime import datetime

# fit model
model = ARIMA(ts, order=(1,0,1)) 
model_fit = model.fit()

# predict
start_index = datetime(2024, 1, 1)
end_index = datetime(2024, 5, 1)
# model_fit.predict(start=start_index, end=end_index)
forecast = model_fit.predict(start = "2024-01-01", end = "2024-05-01")

However, it just shows ValueError: Prediction must have `end` after `start`. Is there anyone having the same issue as well?

ts is a dataframe with two columns, date(index, from 2021/01/01 to 2024/05/02) and gmv

date          gmv
2021-01-01    155629555
2021-01-02    161346990
...
...
2024-01-01    192776022
...
2024-05-01    207816942
2024-05-02    217788026

1 Answer 1

0

Make sure to define ts and the date range for prediction correctly. In this case, you will need to supply start and end parameters to the predict function in the format that is compatible with the index of the time series.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.