Yahoo Finance API/URL 不起作用:Pandas DataReader 的 Python 修复 [英] Yahoo Finance API / URL not working: Python fix for Pandas DataReader

查看:48
本文介绍了Yahoo Finance API/URL 不起作用:Pandas DataReader 的 Python 修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自 2017 年 5 月 16 日以来,无法使用 Pandas DataReader 的雅虎"方法访问雅虎财经 URL.我尚未测试此修复程序-yahoo-finance:https://pypi.python.org/pypi/fix-yahoo-finance 昨天刚刚发布,声明:雅虎金融已经停用了他们的历史数据 API".

编辑 2017 年 8 月 2 日:我已经按照 https://pypi 中的步骤操作.python.org/pypi/fix-yahoo-finance 到:$ pip3 install fix_yahoo_finance --upgrade --no-cache-dir,升级 pandas_datareader 以使用fix-yahoo-finance 0.0.6",以及修改后的代码:

from pandas_datareader 导入数据为 pdr导入 fix_yahoo_financedata = pdr.get_data_yahoo('AAPL', start='2017-04-23', end='2017-05-24')

请注意,最后 2 个数据列的顺序是Adj Close"和Volume",即.不是以前的格式.出于我的目的,它们只是重置为原始格式:

cols = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Close']data.reindex(列=列)

解决方案

我已按照 https://pypi.python.org/pypi/fix-yahoo-finance 到:$ pip3 install fix_yahoo_finance --upgrade --no-cache-dir 并升级了 pandas_datareader 以确保.>

fix-yahoo-finance 0.0.6"运行良好,例如 BHP.AX:

from pandas_datareader 导入数据为 pdr导入 fix_yahoo_financedata = pdr.get_data_yahoo('BHP.AX', start='2017-04-23', end='2017-05-24')

请注意,最后 2 个数据列的顺序是Adj Close"和Volume",即.不是以前的格式.为了我的目的,它们被重置为原始格式:

cols = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Close']data.reindex(列=列)

Yahoo Finance URL has not been accessible using the Pandas DataReader's "yahoo" method since 16 May 2017. I have yet to test this fix-yahoo-finance: https://pypi.python.org/pypi/fix-yahoo-finance that was posted just yesterday, with the statement: "Yahoo! finance has decommissioned their historical data API".

EDIT August 2, 2017: I have since followed the steps in https://pypi.python.org/pypi/fix-yahoo-finance to: $ pip3 install fix_yahoo_finance --upgrade --no-cache-dir, upgraded pandas_datareader to work with "fix-yahoo-finance 0.0.6", and amended codes:

from pandas_datareader import data as pdr
import fix_yahoo_finance

data = pdr.get_data_yahoo('AAPL', start='2017-04-23', end='2017-05-24')

Note that the order of the last 2 data columns are 'Adj Close' and 'Volume' ie. not the previous format. For my purpose, they are simply reset to the original format:

cols = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Close']
data.reindex(columns=cols)

解决方案

I have followed the steps in https://pypi.python.org/pypi/fix-yahoo-finance to: $ pip3 install fix_yahoo_finance --upgrade --no-cache-dir and also upgraded pandas_datareader to be sure.

The "fix-yahoo-finance 0.0.6" worked well, for example BHP.AX:

from pandas_datareader import data as pdr
import fix_yahoo_finance

data = pdr.get_data_yahoo('BHP.AX', start='2017-04-23', end='2017-05-24')

Note that the order of the last 2 data columns are 'Adj Close' and 'Volume' ie. not the previous format. For my purpose, they are reset to the original format:

cols = ['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Close']
data.reindex(columns=cols)

这篇关于Yahoo Finance API/URL 不起作用:Pandas DataReader 的 Python 修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆