Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

  1. I want to predict stock data, generator future stock data a few days later
  2. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
245 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...