Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
This code works with most Ticker symbols:
from pandas_datareader import data as web import datetime as dt start = dt.datetime(2001, 1, 1) end = dt.datetime(2016, 12, 31) df = web.get_data_yahoo('CBS', start=start, end=end) print(df.head())
But is does not work for these Ticker symbols (subset).
I get the following error message.
return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 108, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1601, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1608, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'Date'
I'm using python 3.6 on ubuntu with the following packages:
I have the same problem. It seems to occur when a ticker is valid but data for the day doesn't exist. This results in an empty data frame being returned. A quick fix in the codebase itself is to catch KeyError on line 228 of base.py (inside function _dl_mult_symbols()