There are some similar questions, but the replies there do not work for me.
I am trying to do this, as explained in the warnings documentation:
def disable_pandas_warnings():
import warnings
warnings.resetwarnings() # Maybe somebody else is messing with the warnings system?
warnings.filterwarnings('ignore') # Ignore everything
# ignore everything does not work: ignore specific messages, using regex
warnings.filterwarnings('ignore', '.*A value is trying to be set on a copy of a slice from a DataFrame.*')
warnings.filterwarnings('ignore', '.*indexing past lexsort depth may impact performance*')
And I call this at the start of my test/program:
disable_pandas_warnings()
As you can see in the comments, I have:
- made sure that the warnings filters are not polluted (since filtering is performed on a first-match way)
- ignore all messages
- ignore specific messages (by giving message regex)
Nothing seems to work: messages are still displayed. How can I disable all warnings?