Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

FutureWarning about set_index (in_place=True) is raised even if you already fixed that #2841

darindillon opened this Issue Feb 11, 2013 · 4 comments


None yet
2 participants

Pandas 0.10.1.
It's throwing a FutureWarning "set_index with inplace=True will return None from pandas 0.11 onward" when I call set_index, _even though I already changed my code to be compliant with that change so the warning is not relevant_. It prints that warning anytime you call the function with inplace=True even if you are not using the return value. As it stands, the warning is largely useless -- if I call set_index in 20 places and I fixed 19 of them to not use the return code but missed the last one; then the warning is thrown on the first call (which I fixed) but not on the 20th call (which I didn't fix), so it doesn't help anyone find places to fix in their code.

This warning is "harmless" in the sense it doesn't crash my code; but it is harmful in the sense that it clutters my error/warning log and therefore causing false positives in our infrastructure to notify us on job warnings/errors.

Ideally, pandas should only print the warning if its relevant to you (IE, you haven't yet fixed your code) but I realize that's hard. If that's not possible, then can we have some sort of global option to disable that warning?

OK, I saw pydata#1893 so I now understand why it was done that way; but I still believe we need some kind of global setting to filter out the warning. Otherwise, it causes too many false positive warnings in our logs.


jreback commented Feb 11, 2013

This will turn it off

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

Yes, but that turns off ALL futureWarnings, even those from other libraries, which are relevant to us. We don't want to disable all warnings, only the ones that are not relevant to us.
I was thinking of something like:

pandas.warnings.disable("1893") #where 1893 is the number of this particular pandas warning

There's a long debate on this over at pydata#1893 . The real issue is we want python to have a consistent way of dealing with warnings. (See pydata#2842 )

If you want to close this thread as a duplicate of those two threads, then go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment