import datetime as dtimport matplotlib.pyplot as pltfrom matplotlib import styleimport pandas as pdimport pandas_datareader.data as webstyle.use('ggplot')start = dt.datetime(2000,1,1)end = dt.datetime(2016,12,31)df = web.DataReader('INPX', 'yahoo', start, end) ImmediateDeprecationError Traceback (most recent call last)<ipython-input-11-d0b9e16fb581> in <module>()----> 1 df = web.DataReader('INPX', 'yahoo', start, end)/anaconda3/lib/python3.6/site-packages/pandas_datareader/data.py in DataReader(name, data_source, start, end, retry_count, pause, session, access_key)289 """290 if data_source == "yahoo":--> 291 raise ImmediateDeprecationError(DEP_ERROR_MSG.format('Yahoo Daily'))292 return YahooDailyReader(symbols=name, start=start, end=end,293 adjust_price=False, chunksize=25,ImmediateDeprecationError: Yahoo Daily has been immediately deprecated due to large breaks in the API without theintroduction of a stable replacement. Pull Requests to re-enable these dataconnectors are welcome.See https://github.com/pydata/pandas-datareader/issues我尝试了链接,但是找不到立即折旧错误的原因。我还尝试将'yahoo'更改为'google',即:df = web.DataReader('INPX','google',开始,结束),但仍然存在错误:/anaconda3/lib/python3.6/site-packages/pandas_datareader/google/daily.py:40: UnstableAPIWarning: The Google Finance API has not been stable since late 2017. Requests seemto fail at random. Failure is especially common when bulk downloading.warnings.warn(UNSTABLE_WARNING,UnstableAPIWarning)b'Sorry ... body {font-family:verdana,arial,sans-serif; 背景颜色:#fff; 颜色:#000; } Google对不起......但是您的计算机或网络可能正在发送自动查询。为了保护我们的用户,我们目前无法处理您的请求。
2 回答
jeck猫
TA贡献1909条经验 获得超7个赞
只需使用
import pandas_datareader.data as web
sp500 = web.get_data_yahoo('SPY', start=start, end=end)
精慕HU
TA贡献1845条经验 获得超8个赞
该错误是不言自明的。Yahoo API已更改,因此从Yahoo API读取的旧的Pandas代码不再起作用。你读过这个讨论有关API的变化及其对大熊猫的影响?本质上,Pandas无法读取新的Yahoo API,并且将花费很长时间来编写新代码,因此临时解决方案是在ImmediateDeprecationError每次有人尝试将Pandas用于Yahoo API时提出建议。
添加回答
举报
0/150
提交
取消
