import pandas as pd
from fbprophet import Prophet
df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv')
df.head()
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=365)
future.tail()
forecast = m.predict(future)
forecast.tail()
fig1 = m.plot(forecast)
fig2 = m.plot_components(forecast)
df = pd.read_csv('https://raw.githubusercontent.com/danielcaraway/data/master/Zip_Zhvi_SingleFamilyResidence.csv', encoding='latin')
CA = df[df.State == 'CA']
LA = CA[CA.CountyName == 'Los Angeles County']
mine = LA[LA.RegionName == 90039]
df = mine.copy()
df_t = df.loc[:, '1997-01':'2018-12'].T
df = df_t.copy()
df.reset_index(inplace=True)
# df['ds'] = df[df.columns[1]] + '-01'
df.columns = ['ds','y']
# df['ds'] = df['ds'] + '-01'
df.head()
df.tail()
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=365)
future.tail()
forecast = m.predict(future)
forecast.tail()
fig1 = m.plot(forecast)
# df = pd.read_csv('../examples/example_retail_sales.csv')
m = Prophet(seasonality_mode='multiplicative').fit(df)
future = m.make_future_dataframe(periods=48)
fcst = m.predict(future)
fig = m.plot(fcst)
fcst
len(df)
m = Prophet(seasonality_mode='multiplicative', mcmc_samples=264).fit(df)
future = m.make_future_dataframe(periods=120, freq='M')
fcst = m.predict(future)
fig = m.plot(fcst)
m = Prophet(seasonality_mode='multiplicative', mcmc_samples=264).fit(df)
future = m.make_future_dataframe(periods=12, freq='M')
fcst = m.predict(future)
fig = m.plot(fcst)
df
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=12, freq='M')
future.tail()
forecast = m.predict(future)
forecast.tail()
fig1 = m.plot(forecast)
forecast.tail()