熊猫,DataReader没有加载谷歌财经数据

问题描述 投票:0回答:2

我试图通过pandas_datareader下载谷歌财经的数据。

当我执行:

import pandas_datareader.data as web
from datetime import datetime
start = datetime(2018, 1, 2)
end = datetime(2018, 10, 12)
ms = web.DataReader('MS', 'google', start, end)
x = f.iloc[:,3]
print (x)

我得到如下:

RemoteDataError:无法读取URL:https://finance.google.com/finance/historical?q=MS&startdate=Jan+02%2C+2018&enddate=Oct+12%2C+2018&output=csv 响应文本:b'<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>Sorry...</title><style> body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style></head><body><div><table><tr><td><b><font face=sans-serif size=10><font color=#4285f4>G</font><font color=#ea4335>o</font><font color=#fbbc05>o</font><font color=#4285f4>g</font><font color=#34a853>l</font><font color=#ea4335>e</font></font></b></td><td style="text-align: left; vertical-align: bottom; padding-bottom: 15px; width: 50%"><div style="border-bottom: 1px solid #dfdfdf;">Sorry...</div></td></tr></table></div><div style="margin-left: 4em;"><h1>We\'re sorry...</h1><p>... but your computer or network may be sending automated queries. To protect our users, we can\'t process your request right now.</p></div><div style="margin-left: 4em;">See <a href="https://support.google.com/websearch/answer/86640">Google Help</a> for more information.<br/><br/></div><div style="text-align: center; border-top: 1px solid #dfdfdf;"><a href="https://www.google.com">Google Home</a></div></body></html>'

如何访问没有进入这个数据?此外,请注意使用其他的API,如IEX,DataReader的工作的罚款(不仅仅是谷歌财经的数据具有更广泛的可用性)。

python datareader google-finance
2个回答
0
投票

这是在大熊猫的DataReader所使用的谷歌财经终端已经discontinued。因此,谷歌财经已经deprecated(标记为删除)作为目前熊猫DataReader的版本(0.7.0)。

您可能使用熊猫DataReader的,这就是为什么使用qazxsw POI的qazxsw POI数据源提出了一个qazxsw POI而不是google的早期verison。

为了解决你的问题,我会建议使用不同的数据源,如web.DataReader

RemoteDataError

其他选项包括ImmediateDeprecationErrorIEX


0
投票

我运行下面的代码通过使用“雅虎”拉每日股票价格。下面是代码。


ms = web.DataReader("ms", "iex", start, end)
© www.soinside.com 2019 - 2024. All rights reserved.