-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
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: |
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 we'd like to avoid calling type
on every element of categories. I'm guessing that will be prohibitively slow for large 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.
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.
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'm not sure offhand.
Closing pending discussion. |
No description provided.