-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Fix is_categorical_dtype for Sparse[category] #35797
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
Changes from 11 commits
a86a7ff
29241d2
b52a7ea
8d51429
41d58a0
6c482bc
582e6e4
19b0aae
1343a4a
5a031aa
a799d73
a4388d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -287,6 +287,10 @@ def is_dtype(cls, dtype: object) -> bool: | |
return False | ||
elif isinstance(dtype, cls): | ||
return True | ||
elif hasattr(dtype, "subtype") and isinstance( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need to add this, this is a perf sensitive piece. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's needed for test_is_categorical_sparse_categorical to pass; I'm not sure if there's another way to make this work. I ran the dtype asvs and didn't see a degradation. |
||
dtype.subtype, cls # type: ignore[attr-defined] | ||
): | ||
return True | ||
if isinstance(dtype, str): | ||
try: | ||
return cls.construct_from_string(dtype) is not None | ||
|
Uh oh!
There was an error while loading. Please reload this page.