Professional Documents
Culture Documents
FB Prophet Python
FB Prophet Python
cols = ['Make','Model','Year','Referer','Timestamp']
BMW.drop(cols, axis=1, inplace=True)
Audi.drop(cols, axis=1, inplace=True)
BMW = BMW.sort_values('Created')
Audi = Audi.sort_values('Created')
BMW = BMW.groupby('Created')['Price'].sum().reset_index()
Audi = Audi.groupby('Created')['Price'].sum().reset_index()
BMW = BMW.set_index('Created')
Audi = Audi.set_index('Created')
y_BMW = BMW['Price'].resample('MS').mean()
y_Audi = Audi['Price'].resample('MS').mean()
BMW = pd.DataFrame({'Created':y_BMW.index, 'Price':y_BMW.values})
Audi = pd.DataFrame({'Created': y_Audi.index, 'Price': y_Audi.values})
store = BMW.merge(Audi, how='inner', on='Created')
store.rename(columns={'Price_x': 'BMW_Price', 'Price_y': 'Audi_Price'}, inplace=True)
store.head()
plt.figure(figsize=(10, 7))
plt.plot(forecast['Created'], forecast['BMW_yhat'], 'b-')
plt.plot(forecast['Created'], forecast['Audi_yhat'], 'r-')
plt.legend(); plt.xlabel('Created'); plt.ylabel('Sales')
plt.title('BMW vs. Audi Supplies Estimate');