잠토의 잠망경

[ai] Prophet 본문

공부/Python

[ai] Prophet

잠수함토끼 2021. 5. 29. 01:08

colab에 파일 업로드하기

from google.colab import files
myfile = files.upload()

날짜

Prophet은 2021-01-02 같은 형식으로 해야 인식된다.

prophet 써보기


from fbprophet import Prophet


from google.colab import files
myfile = files.upload()


from pandas import DataFrame
import pandas as pd
import io

rawdatas = pd.read_csv(io.BytesIO(myfile['new 1.txt']))
rawdatas = rawdatas.iloc[::-1]

print(rawdatas)


df = rawdatas.reset_index(drop=True)
df = df.reset_index()

df['ds'] = df['S_DATE']
df['y'] = df['S_CLOSE']
data = df[['ds', 'y']]

print(data)

m = Prophet()
m.fit(df)

future = m.make_future_dataframe(periods=100, freq='D')
forecast = m.predict(future)

fig1 = m.plot(forecast)

Comments