Skip to content

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

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
darindillon opened this issue Feb 11, 2013 · 4 comments
Milestone

Comments

@darindillon
Copy link

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?

@darindillon
Copy link
Author

OK, I saw #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
Copy link
Contributor

jreback commented Feb 11, 2013

This will turn it off

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

@darindillon
Copy link
Author

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

@darindillon
Copy link
Author

There's a long debate on this over at #1893 . The real issue is we want python to have a consistent way of dealing with warnings. (See #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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants