More info: https://www.quandl.com/tools/python
conda install quandl
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import quandl
# quandl.ApiConfig.api_key = "Your api key here"
This call gets the WTI Crude Oil price from the US Department of Energy. Note that you need to know the Quandl code of each dataset you download. For this example, it is "EIA/PET_RWTC_D".:
mydata = quandl.get("EIA/PET_RWTC_D")
mydata.head()
mydata.plot(figsize=(12,6))
You can get the same data in a NumPy array:
mydata = quandl.get("EIA/PET_RWTC_D", returns="numpy")
mydata
To set start and end dates:
mydata = quandl.get("FRED/GDP", start_date="2001-12-31", end_date="2005-12-31")
mydata.head()
mydata = quandl.get(["NSE/OIL.1", "WIKI/AAPL.4"])
mydata.head()
The Quandl Python module is free. If you would like to make more than 50 calls a day, however, you will need to create a free Quandl account and set your API key:
# EXAMPLE
quandl.ApiConfig.api_key = "YOUR_KEY_HERE"
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.
mydata = quandl.get('WIKI/FB',start_date='2015-01-01',end_date='2017-01-01')
mydata.head()
Get a Single Column Data
mydata = quandl.get('WIKI/FB.1',start_date='2015-01-01',end_date='2017-01-01')
mydata.head()
mydata = quandl.get('WIKI/FB.7',start_date='2015-01-01',end_date='2017-01-01')
mydata.head()
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.
houses = quandl.get('ZILLOW/M11_ZRIAH')
houses.head()
houses.plot()