pandas-datareader
pandas-datareader copied to clipboard
Wrong type for api_key in data.py
I'm trying to use pandas_datareader for data from Quandl where I have registered and have the API key. I try to obtain data in this way:
df = web.DataReader(symbol, data_source, begin_date, end_date, api_key=('9_wmnkKvwM_HVj1btisX', None))[['AdjOpen', 'AdjHigh', 'AdjLow', 'AdjClose', 'AdjVolume']].reset_index()
and I get this error:
ValueError: The Quandl API key must be provided either through the api_key variable or through the environmental variable QUANDL_API_KEY.
I have found in the data.py module that variable api_key needs to be a touple in the form (str, None) and on the 499th line, when using quandl, it is passed to the constructor of the QuandlReader.
In QuandlReader api_key is defined as str and on 64th line it is checked if it is an instance of str in this way:
if not api_key or not isinstance(api_key, str)
This will never be satisfied since api_key is always passed as a part of the tuple and not as a str from data.py and will always cause previously mentioned error.
I'm new to pandas_datareader and don't know whether I'm missing something and it this a bug?