Skip to content

Instantly share code, notes, and snippets.

@peter-stuart-turner
Created November 19, 2019 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter-stuart-turner/af01d1bad7610f3215272d27e52d50e2 to your computer and use it in GitHub Desktop.
Save peter-stuart-turner/af01d1bad7610f3215272d27e52d50e2 to your computer and use it in GitHub Desktop.
## Read in data (skip 2028 Silver Institute 'predicted' entry)
est_thrifting = pd.read_excel('../data/silver_solar_thrifting_estimates.xlsx').iloc[0:10]
fc_loadings = pd.DataFrame(columns=['ds','y'])
fc_loadings['ds'] = est_thrifting['Year'].values
fc_loadings['ds'] = fc_loadings['ds'].apply(lambda d: datetime.datetime.strptime(str(d), "%Y"))
fc_loadings['y'] = est_thrifting['Market Average Silver Loadings (g/cell)'].values
model_loadings = fbprophet.Prophet(changepoint_prior_scale=5)
model_loadings.fit(fc_loadings)
future_df_loadings = model_loadings.make_future_dataframe(periods=30, freq='y')
forecast_loadings = model_loadings.predict(future_df_loadings)
model_loadings.plot(forecast_loadings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment