import matplotlib import pandas as pd from fbprophet import Prophet import matplotlib.pyplot as plt plt.style.use('fivethirtyeight') #input dataset with one date column and one value column df = pd.read_csv('syf_prophet.csv') #parse date column to datetime df['DOWNLOAD_ACTIVITY_DATE']=df['DOWNLOAD_ACTIVITY_DATE'].astype('datetime64[ns]') print df.shape print df.dtypes #rename columns to prophet standard df = df.rename(columns={'DOWNLOAD_ACTIVITY_DATE': 'ds', 'SUM(UNITS)': 'y'}) print df.head(5) ax = df.set_index('ds').plot(figsize=(12, 8)) ax.set_ylabel('Spotify Streams') ax.set_xlabel('Date') #define model my_model = Prophet(interval_width=0.8) #fit model my_model.fit(df) #make rows for future dates future_dates = my_model.make_future_dataframe(periods=14) print future_dates.tail() #create predictions forecast = my_model.predict(future_dates) print forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail(14) my_model.plot(forecast, uncertainty=True) my_model.plot_components(forecast) plt.show()