import pandas as pd
import numpy as np
train = pd.read_csv('./train.csv')
print(train.head())
train['Datetime'] = pd.to_datetime(train.Datetime, format='%d-%m-%Y %H:%M')
train.index = train.Datetime
train.drop(['ID', 'Datetime'], axis=1, inplace=True)
daily_train = train.resample('D').sum()
daily_train['ds'] = daily_train.index
daily_train['y'] = daily_train.Count
daily_train.drop(['Count'], axis=1, inplace=True)
print(daily_train)
from fbprophet import Prophet
m = Prophet(yearly_seasonality=True, seasonality_prior_scale=0.1)
m.fit(daily_train)
future = m.make_future_dataframe(periods=213)
print(future.tail())
forecast = m.predict(future)
m.plot(forecast)
m.plot_components(forecast)
转载请注明原文地址:https://ipadbbs.8miu.com/read-3167.html