January 2020
Beginner to intermediate
432 pages
11h 24m
English
Execute the following steps to decompose the gold prices time series using Facebook's Prophet and create forecasts for one year ahead.
import pandas as pdimport seaborn as snsimport quandlfrom fbprophet import ProphetQUANDL_KEY = '{key}' # replace {key} with your own API key quandl.ApiConfig.api_key = QUANDL_KEY
df = quandl.get(dataset='WGC/GOLD_DAILY_USD', start_date='2000-01-01', end_date='2005-12-31')df.reset_index(drop=False, inplace=True)df.rename(columns={'Date': 'ds', 'Value': 'y'}, inplace=True)
train_indices = df.ds.apply(lambda x: x.year) < 2005df_train ...
Read now
Unlock full access