Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'date' #106

Open
veonua opened this issue Dec 6, 2018 · 4 comments
Open

KeyError: 'date' #106

veonua opened this issue Dec 6, 2018 · 4 comments

Comments

@veonua
Copy link

veonua commented Dec 6, 2018

KeyError: 'date'

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/empyrical/utils.py in get_symbol_returns_from_yahoo(symbol, start, end)
435 px = web.get_data_yahoo(symbol, start=start, end=end)
--> 436 px['date'] = pd.to_datetime(px['date'])
437 px.set_index('date', drop=False, inplace=True)

Date is index field
Index(['High', 'Low', 'Open', 'Close', 'Volume', 'Adj Close'], dtype='object')

@eigenfoo
Copy link
Contributor

It's a little hard to help you diagnose your issue without your code. Could you please give us a reproducible example?

@veonua
Copy link
Author

veonua commented Dec 11, 2018

just open https://github.com/quantopian/empyrical/blob/master/empyrical/utils.py#L436

and remove lines 436 and 437

@eigenfoo
Copy link
Contributor

Please see https://github.com/quantopian/empyrical#deprecated-data-reading-via-pandas-datareader

Since #97 we have deprecated all data-reading functionality from empyrical.

@hrosspet
Copy link

hrosspet commented Oct 29, 2019

and remove lines 436 and 437

and change:
rets = px[['adjclose']].pct_change().dropna()
to
rets = px[['Adj Close']].pct_change().dropna()

I made a PR, let's see if Quantutopian will merge it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants