Getting data from Quandl

pandas_datareader is a nice library which provides access to sotck (and not only) data. The dat ais directly downloaded into pandas DataFrames, which provides user-frendly functions for preliminary data analysis. Yet, probably one of the biggest data financial and economic data supplier nowdays is Quandl. We already used Quandl to get data into Excel. It turns out there is a separate library for Python also (called quandl). The only function one needs to use from that library is get() which takes only one required argument: name of the stock (followed after the database name, as in Excel). Dates are set by default to the very start/end. Nice thing about Quandl library is that it automatically downloads the data into Python as a DataFrame. Let's experience it.


In [1]:
import quandl

In [2]:
# Let's get US nominal GDP data from the FRED (Federal Reserve Economic Data) database
data = quandl.get("FRED/GDP")

In [3]:
data.head()


Out[3]:
Value
Date
1947-01-01 243.1
1947-04-01 246.3
1947-07-01 250.1
1947-10-01 260.3
1948-01-01 266.2

In [4]:
type(data)


Out[4]:
pandas.core.frame.DataFrame