-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/PERF: sparse min/max don't densify #43527
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
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.
small comment, ping on green.
func = max if kind == "max" else min | ||
return func(sp_min_max, self.fill_value) | ||
else: | ||
return sp_min_max | ||
else: |
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.
might has well just do elif else
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.
thanks, updated
thanks @mzeitlin11 |
This now follows the structure of other
SparseArray
reductions likesum
more closely, though there is some added complexity here to avoid taking themin/max
of an empty array, which would raise when we want to return the corresponding missing value instead.Benchmarks: