Skip to content

REF: remove single-tuple special case for Categorical.__hash__ #33678

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
wants to merge 8 commits into from

Conversation

jbrockmendel
Copy link
Member

No description provided.

@jbrockmendel
Copy link
Member Author

cc @TomAugspurger looks like this was added in #16015, LMK if this special case is actually still needed

cat_array = hash_array(np.asarray(categories), categorize=False)

if categories.dtype == "O":
if len({type(x) for x in categories}) != 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'd like to avoid calling type on every element of categories. I'm guessing that will be prohibitively slow for large categories.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Can you comment on why something like hash(str(np.asarray(categories))) wasnt used?

The imports from core.util.hashing are a hassle dependency-structure-wise, so if there is a simplification available itd be helpful, but not urgent.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure offhand.

@jbrockmendel
Copy link
Member Author

Closing pending discussion.

@jbrockmendel jbrockmendel deleted the ref-hashing branch April 20, 2020 21:17
@jbrockmendel jbrockmendel added the Mothballed Temporarily-closed PR the author plans to return to label Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mothballed Temporarily-closed PR the author plans to return to
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants