In [2]:
# imports
import pandas as pd
from datetime import datetime as dt
pd.core.common.is_list_like = pd.api.types.is_list_like # workaround
import pandas_datareader.data as pdd
import matplotlib.pyplot as plt
# CONST
Sdt = dt(1990, 1, 1) # negative infinity date
Edt = dt(2020, 1, 1) # future date
SW = "HSGS2564W" # Unemployment Rate - High School Graduates, No College, 25 to 64 years, Women
SM = "HSGS2564M" # Unemployment Rate - High School Graduates, No College, 25 to 64 years, Men
Grab data with DataReader¶
Arguments are
- series wanted or a list of series wanted
- constant "fred" to indicate we are reading from FRED. Could have supplied instead "google" for Google Finance, or "ff" for Kenneth French's data library
- earliest datetime wanted
- latest datetime wanted
There are some additional arguments not use here. For more details, help(pdd.DataReader).
In [3]:
# grab data
noCollegeDF = pdd.DataReader((SW, SM), "fred", Sdt, Edt)
noCollegeDF.head()
Out[3]:
Plot¶
In [4]:
%matplotlib inline
fig, ax = plt.subplots()
noCollegeDF.plot(ax=ax)
plt.title("Unemployment for HS Grads with No College W and M")
Out[4]:
Above available as notebook.
ReplyDelete