Skip to content

BUG: Categorical setitem, comparison with tuple category #36623

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

Merged
merged 3 commits into from
Oct 2, 2020

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Sep 25, 2020

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - can you add a whatsnew?

@WillAyd WillAyd added the Categorical Categorical Data Type label Sep 25, 2020
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WillAyd WillAyd added this to the 1.2 milestone Sep 29, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also check getitem?

@@ -1883,7 +1885,8 @@ def _validate_setitem_value(self, value):
new_codes = self._validate_listlike(value)
value = Categorical.from_codes(new_codes, dtype=self.dtype)

rvalue = value if is_list_like(value) else [value]
# wrap scalars and hashable-listlikes in list
rvalue = value if not is_hashable(value) else [value]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use maybe_make_list (but certainly can followup as may need to change that definition slightly)

@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Sep 30, 2020
@jbrockmendel
Copy link
Member Author

jbrockmendel commented Sep 30, 2020

can you also check getitem?

not sure i follow. you mean check that cat[i] gives a tuple? pretty sure we already have tests for that

@jreback
Copy link
Contributor

jreback commented Oct 2, 2020

can you also check getitem?

not sure i follow. you mean check that cat[i] gives a tuple? pretty sure we already have tests for that

ok then.

@jreback jreback merged commit 40daf00 into pandas-dev:master Oct 2, 2020
@jbrockmendel jbrockmendel deleted the bug-20439 branch October 2, 2020 22:59
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Categorical.__setitem__ doesn't handle setting tuples
3 participants