-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: faster categorical ops for equal or larger than scalar #29820
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 all commits
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 |
---|---|---|
|
@@ -108,9 +108,9 @@ def func(self, other): | |
else: | ||
other_codes = other._codes | ||
|
||
mask = (self._codes == -1) | (other_codes == -1) | ||
f = getattr(self._codes, opname) | ||
ret = f(other_codes) | ||
mask = (self._codes == -1) | (other_codes == -1) | ||
if mask.any(): | ||
# In other series, the leads to False, so do that here too | ||
ret[mask] = False | ||
|
@@ -121,9 +121,10 @@ def func(self, other): | |
i = self.categories.get_loc(other) | ||
ret = getattr(self._codes, opname)(i) | ||
|
||
# check for NaN in self | ||
mask = self._codes == -1 | ||
ret[mask] = False | ||
if opname not in {"__eq__", "__ge__", "__gt__"}: | ||
# check for NaN needed if we are not equal or larger | ||
mask = self._codes == -1 | ||
ret[mask] = False | ||
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 have a performance test for this? 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. No, no ASV's for this ATM. I actually can't get ASV to run locally, maybe a Windows issue? Anyway, I've added I've a ASV test set, but haven't been able to run it myself, unforfunately. Isn't there a web page, where we post ASVs? |
||
return ret | ||
else: | ||
if opname == "__eq__": | ||
|
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.
Just moved this down so the constructor checks are first, which seems logical.