-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REGR: Fix bug when replacing categorical value with self #33292
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
LGTM pending green |
@dsaxton If you rebase it should fix the Travis issue |
@dsaxton I've tagged this as 1.0.4 for now since #33288 is a regression. I don't think need to move whatsnew yet, see #33157 (comment) opened #33300 to help keep track and discuss |
pandas/core/arrays/categorical.py
Outdated
@@ -2463,7 +2463,8 @@ def replace(self, to_replace, value, inplace: bool = False): | |||
if new_value in cat.categories: |
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.
you can move this check to line 2451, e.g.
elif replace_value == new_value:
continue
@@ -64,6 +64,7 @@ def test_isin_cats(): | |||
[ | |||
("b", "c", ["a", "c"], "Categorical.categories are different"), | |||
("c", "d", ["a", "b"], None), | |||
("a", "a", ["a", "b"], 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.
can you annotate this case (add a comment on line before with this issue number)
@dsaxton if other comments are addressed, can you re-push? the docbuild should be OK now |
thanks @dsaxton |
…acing categorical value with self)
…gorical value with self) (#34004) Co-authored-by: Daniel Saxton <2658661+dsaxton@users.noreply.github.com>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff