Getting a “Future Warning” when importing for Yahoo with Pandas-Datareader

偶尔善良 提交于 2020-06-27 14:54:10

问题


I am currently , successfully, importing stock information from Yahoo using pandas-datareader. However, before the extracted data, I always get the following message:

FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.

Would anyone have an idea of what it means and how to fix it?


回答1:


That's a change (at least) in location of pandas testing functions: no longer under pandas.util.testing, but under pandas.testing instead. It's a waring that it will eventually stop working if you keep the current version.

Try upgrading the pandas module:

pip3 install pandas --upgrade



回答2:


You may find the 'util.testing' code in pandas_datareader, which is separate from pandas.




回答3:


If you are using this from pandas_datareader import data import it has deprecated.

Replace it with:

from pandas_datareader import data, wb

or

import pandas_datareader as pdr

Because many functions from the data module have been included in the top level API.




回答4:


Try below line to import, it will work.

import pandas_datareader.data as web

For more information find the below link.

https://www.reddit.com/r/learnpython/comments/fel32c/getting_a_future_warning_error_on_a_simple_web/




回答5:


For mac OS open /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pandas_datareader/compat/__init__.py

change: from pandas.util.testing import assert_frame_equal

to: from pandas.testing import assert_frame_equal



来源:https://stackoverflow.com/questions/60039161/getting-a-future-warning-when-importing-for-yahoo-with-pandas-datareader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!