问题
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