module 'pandas_datareader' has no attribute 'get_data_yahoo'

Joey Baruch picture Joey Baruch · May 17, 2017 · Viewed 8.1k times · Source

I'm trying to get stock market history using pandas-datareader as specified in this SO question.

I've installed pandas-datareader with:
conda install -c https://conda.anaconda.org/anaconda pandas-datareader I'm running on windows 10, with pycharm, and anaconda3 interpreter

I'm trying to run the very basic:

import pandas_datareader as pdr
pdr.get_data_yahoo('AAPL')

But I get an error: File "D:/Dropbox/Duo/documents docs/Projects/F500AquisitionQuality/m_and_a_quality/stock_utils.py", line 2, in <module> pdr.get_data_yahoo('AAPL') AttributeError: module 'pandas_datareader' has no attribute 'get_data_yahoo'

Please note that the filename has nothing to do with pandas as in this reddit comment (the only related thing i could find online)

Answer

Mark Lavrynenko picture Mark Lavrynenko · May 20, 2017

There is a problem with get_data_yahoo in version 0.4.0 (because Yahoo changed API).

To fix it you can install version 0.4.1 (it's not merged yet https://github.com/pydata/pandas-datareader/pull/331 as for May 20 2017)

Following code helped me. I cloned pandas-datareader source code, changed branch, installed package from source code using pip3

git clone https://github.com/pydata/pandas-datareader cd pandas-datareader/ git remote add rgkimball http://github.com/rgkimball/pandas-datareader git fetch rgkimball fix-yahoo git checkout fix-yahoo pip3 uninstall pandas_datareader python3 setup.py install