【发布时间】:2018-10-15 14:47:15
【问题描述】:
我正在尝试通过pandas_datareader 下载 Google 财经数据。
当我执行时:
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,数据读取器工作正常(只是 Google 财经具有更广泛的数据可用性)。
【问题讨论】:
标签: python datareader google-finance