Fixing panda's datareader from yahoo finance with Enthought Canopy

夙愿已清 提交于 2019-12-06 03:13:35

in (assuming that the user is using Enthought Canopy for Windows, and it's stored in the default location):

C:\Users\...\AppData\Local\Enthought\Canopy\System\Lib\site-packages\pandas\io

change yahoo_URL = 'http://ichart.yahoo.com/table.csv?'

to yahoo_URL = 'http://ichart.finance.yahoo.com/table.csv?'

Save and restart Canopy

Here is a current, working version of using Pandas datareader to fetch yahoo quotes:

from pandas.io.data import DataReader
from datetime import datetime

amd = DataReader('AMD',  'yahoo', datetime(2015,7,1), datetime(2015,7,1))
print(amd['Adj Close'][0])

Keep in mind that the returned dataset is an array. You need to enumerate said array to get the data, either by specifying your index, or with a for loop

The other keys you can use are Open, Close, High, Low, and Volume.

I have Pandas v 0.16.2

I hope this helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!