- I want to predict stock data, generator future stock data a few days later
- I went to the problem:
only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices
import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
import warnings
warnings.filterwarnings('ignore')
df = pd.read_excel('01.xlsx',header=0,parse_dates=[0],index_col=0,squeeze=True)
d = pd.date_range(df.index.min(),df.index.max())
df = df[['Close']]
df1 = pd.Series(df['Close'],d)
df1 = df1.dropna()
r = ARIMA(df1,(1,2,0))
model_fit = r.fit(disp=0)
pred = model_fit.predict(start = '2012-07-31', end = '2012-09-01' , typ='levels')
print(pred)
How can I do it?Thanks!
question from:https://stackoverflow.com/questions/66065461/problem-of-python-arima-forecast-and-predict-stock