More info: https://www.quandl.com/tools/python
In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
import quandl
In [3]:
mydata = quandl.get("EIA/PET_RWTC_D")
In [4]:
mydata.head()
Out[4]:
In [5]:
mydata.plot(figsize = (12, 6))
Out[5]:
Note that you need to know the "Quandl code" of each dataset you download. In the above example, it is "EIA/PET_RWTC_D".
In [6]:
mydata = quandl.get("EIA/PET_RWTC_D",
returns = "numpy")
In [7]:
mydata = quandl.get("FRED/GDP",
start_date = "2001-12-31",
end_date = "2005-12-31")
In [8]:
mydata.head()
Out[8]:
In [9]:
mydata = quandl.get(["NSE/OIL.1", "WIKI/AAPL.4"])
In [10]:
mydata.head()
Out[10]:
In [11]:
# EXAMPLE
quandl.ApiConfig.api_key = "2qM_u-g8oxTV6JbhUWLn"
mydata = quandl.get("FRED/GDP")
Each database on Quandl has a short (3-to-6 character) database ID. For example:
Each database contains many datasets. Datasets have their own IDs which are appended to their parent database ID, like this:
You can download all dataset codes in a database in a single API call, by appending /codes to your database request. The call will return a ZIP file containing a CSV.
Every Quandl code has 2 parts: the database code (“WIKI”) which specifies where the data comes from, and the dataset code (“FB”) which identifies the specific time series you want.
You can find Quandl codes on their website, using their data browser.
In [12]:
# FOR STOCKS
In [13]:
mydata = quandl.get('WIKI/FB',
start_date = '2015-01-01',
end_date = '2017-01-01')
In [14]:
mydata.head()
Out[14]:
In [15]:
mydata = quandl.get('WIKI/FB.1',
start_date = '2015-01-01',
end_date = '2017-01-01')
In [16]:
mydata.head()
Out[16]:
In [17]:
mydata = quandl.get('WIKI/FB.7',
start_date = '2015-01-01',
end_date = '2017-01-01')
In [18]:
mydata.head()
Out[18]:
Zillow Home Value Index (Metro): Zillow Rental Index - All Homes - San Francisco, CA
The Zillow Home Value Index is Zillow's estimate of the median market value of zillow rental index - all homes within the metro of San Francisco, CA. This data is calculated by Zillow Real Estate Research (www.zillow.com/research) using their database of 110 million homes.
In [19]:
houses = quandl.get('ZILLOW/M11_ZRIAH')
In [20]:
houses.head()
Out[20]:
In [21]:
houses.plot(figsize = (12, 6))
Out[21]: