pip install pystan
pip install fbprophet
import pandas as pd
import numpy as np
from fbprophet import Prophet
import matplotlib.pyplot as plt
df = pd.read_csv("~/downloads/res2.csv", index_col=[0])
df.head(2)
data = pd.DataFrame({'ds': df.dt,
'y': np.log(df['amount'])})
data.head(2)
m = Prophet()
m.fit(data)
future = m.make_future_dataframe(periods=4)
future.tail()
forecast = m.predict(future)
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail()
m.plot(forecast)
m.plot_components(forecast);
plt.show()
No comments:
Post a Comment