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

3

6

I have seen several of these questions along with some answers about it all however either I'm super dumb and can't work out what they are meaning or I'm just extremely dumb and I'm doing it wrong

I am getting this warning using Pandas and Pandas_datareader

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

This is one of the answers I have seen and I don't understand how to fix it I don't have any code that has 'until.testing' it so I don't know to remove it when it's not there and adding it did nothing but due to the warning, my program won't work on my raspberry pi which is the intended location.

please help

Knotweed answered 23/3, 2020 at 2:16 Comment(2)
Can you edit your question to provide the code that produced this error and the questions and answers that you refer to in your question? It's not possible to help you with the information that you've provided so far.Illjudged
If it's only this warning that is preventing you from running the program in your raspberry pi and you are ok with not seeing any other possible warnings, you could try disabling the warnings from Python by running your progam with python -W ignore <your-python-script-here>. Taken from #14463777Kamala
L
4

It is a warning, it should not prevent your program to run properly. However, it is true that it uglifies the console output. If you want to suppress the warning adding the following lines to the imports of your program will do the job (as suggested here):

import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)

Hope it helps.

Lumbye answered 6/6, 2020 at 23:10 Comment(2)
Random warnings from sub-packages have plagued me for months in my package. Putting this into top the __init__.py file in, the first file imported when someone imports my package silenced them. Doesn't work well if you try to put it into places where pandas is later imported.Calandracalandria
I don't want to suppress warnings. Rather I would like to understand those. Any pointers/answers on what is python trying to warn and how to improve the code? My Code: colab.research.google.com/drive/…Ricoricochet
R
1

open the file:

/Users/your_user_name/anaconda3/lib/python3.7/site-packages/statsmodels/tools/_testing.py

Replace:

from pandas.util.testing import assert_frame_equal

with

from pandas.testing import assert_frame_equal

This solution was taken from this github comment.

Raffaello answered 15/6, 2022 at 10:1 Comment(0)
D
1

If you are using pandas.util.testing to generate a random DataFrame, you can replace

pd.util.testing.makeDataFrame()

to

pd._testing.makeDataFrame()

pd._testing.makeDataFrame()

Downgrade answered 6/12, 2023 at 2:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.