Quandl: US GDP, Implicit Price Deflator

In this notebook, we'll take a look at data set , available on Quantopian. This dataset spans from 1961 through the current day. It contains the value for the United States' inflation rate, using the price deflator. We access this data via the API provided by Quandl. More details on this dataset can be found on Quandl's website.

Blaze

Before we dig into the data, we want to tell you about how you generally access Quantopian partner data sets. These datasets are available using the Blaze library. Blaze provides the Quantopian user with a convenient interface to access very large datasets.

Some of these sets (though not this one) are many millions of records. Bringing that data directly into Quantopian Research directly just is not viable. So Blaze allows us to provide a simple querying interface and shift the burden over to the server side.

To learn more about using Blaze and generally accessing Quantopian partner data, clone this tutorial notebook.

With preamble in place, let's get started:


In [1]:
# import the dataset
from quantopian.interactive.data.quandl import ugid_infl_usa
# Since this data is public domain and provided by Quandl for free, there is no _free version of this
# data set, as found in the premium sets. This import gets you the entirety of this data set.

# import data operations
from odo import odo
# import other libraries we will use
import pandas as pd
import matplotlib.pyplot as plt

In [2]:
ugid_infl_usa.sort('asof_date')


Out[2]:
asof_date value timestamp
0 1961-12-31 1.22958 1961-12-31
1 1962-12-31 1.36649 1962-12-31
2 1963-12-31 1.05941 1963-12-31
3 1964-12-31 1.50905 1964-12-31
4 1965-12-31 1.87817 1965-12-31
5 1966-12-31 2.95282 1966-12-31
6 1967-12-31 3.09600 1967-12-31
7 1968-12-31 4.25566 1968-12-31
8 1969-12-31 4.73254 1969-12-31
9 1970-12-31 7.09738 1970-12-31
10 1971-12-31 5.08252 1971-12-31

The data goes all the way back to 1961 and is updated annually.

Blaze provides us with the first 10 rows of the data for display. Just to confirm, let's just count the number of rows in the Blaze expression:


In [3]:
ugid_infl_usa.count()


Out[3]:
53

Let's go plot it for fun. This data set is definitely small enough to just put right into a Pandas DataFrame


In [4]:
inf_df = odo(ugid_infl_usa, pd.DataFrame)

inf_df.plot(x='asof_date', y='value')
plt.xlabel("As Of Date (asof_date)")
plt.ylabel("Inflation Rate")
plt.title("US Inflation, Implicit Price Deflator")
plt.legend().set_visible(False)



In [ ]: