January 2020
Beginner to intermediate
432 pages
11h 24m
English
Execute the following steps to use the exponential smoothing methods to create forecasts of Google's stock prices.
import pandas as pdimport numpy as npimport yfinance as yffrom datetime import datefrom statsmodels.tsa.holtwinters import (ExponentialSmoothing, SimpleExpSmoothing, Holt)
df = yf.download('GOOG', start='2010-01-01', end='2018-12-31', adjusted=True, progress=False)
goog = df.resample('M') \ .last() \ .rename(columns={'Adj Close': 'adj_close'}) \ .adj_close
train_indices = goog.index.year < 2018goog_train = goog[train_indices]goog_test = goog[~train_indices]test_length ...
Read now
Unlock full access