Python practice
As mentioned in the introduction to this chapter, we are going to be using the statsmodels library for modeling.
Requirements
In this chapter, we'll use several libraries, which we can quickly install from the terminal (or similarly from the anaconda navigator):
pip install statsmodels pandas_datareader
We'll execute the commands from the Python (or IPython) terminal, but equally, we could execute them from a Jupyter notebook (or a different environment).
Let's get down to modeling!
Modeling in Python
We'll work with a stock ticker dataset from Yahoo finance that we'll download through the yfinance library. We'll first load the dataset, do some quick exploration, and then we'll build several models mentioned in this chapter.
We'll load a series of Standard & Poor's depositary receipts (SPDR S&P 500 ETF Trust):
from datetime import datetime
import yfinance as yf
start_date...