为了账号安全,请及时绑定邮箱和手机立即绑定

使用数据读取器时的InstantDeprecationError

使用数据读取器时的InstantDeprecationError

料青山看我应如是 2021-03-30 09:11:50
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)


查看完整回答
反对 回复 2021-04-27
?
精慕HU

TA贡献1845条经验 获得超8个赞

该错误是不言自明的。Yahoo API已更改,因此从Yahoo API读取的旧的Pandas代码不再起作用。你读过这个讨论有关API的变化及其对大熊猫的影响?本质上,Pandas无法读取新的Yahoo API,并且将花费很长时间来编写新代码,因此临时解决方案是在ImmediateDeprecationError每次有人尝试将Pandas用于Yahoo API时提出建议。


查看完整回答
反对 回复 2021-04-27
  • 2 回答
  • 0 关注
  • 212 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号