-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Series.replace with to_replace dict and value=None, nonsensical error message #46689
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can either change the default for value (but I think lib.no_default was added on purpose) or clarify the error message
def test_replace_dictlike_value_None(self): | ||
# GH46004 | ||
ser = pd.Series([1, 2, 3, 4]) | ||
result = ser.replace(to_replace={3: 33}, value=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is supposed to work. We are using lib.no_default as a sentinel to check if value was provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like when we have explicitly to_replace=dict_like and value=None it interpreted as a special case where None is different from lib.no_default. Maybe we need another conditional statement somewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should raise if value=None, otherwise lib.no_default does not make sense
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen. |
Hi there, just curious if this issue still persist. I seem to be getting the same error with series.replace. Could anyone enlighten me if there is a version that would have resolved this? Thank you! |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.