-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: IntervalArray.min/max #44746
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
ENH: IntervalArray.min/max #44746
Conversation
jbrockmendel
commented
Dec 4, 2021
- closes #xxxx
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
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.
needs a rebase as well
pandas/core/arrays/interval.py
Outdated
@@ -790,6 +790,36 @@ def argsort( | |||
ascending=ascending, kind=kind, na_position=na_position, **kwargs | |||
) | |||
|
|||
def min(self, *, axis: int | None = None, skipna: bool = True): | |||
if axis is not None and axis >= self.ndim: | |||
raise ValueError(axis) |
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.
case hit in tests?
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.
Updated with test, also fixes the mypy complaint on master
looks fine, can you merge master and ping on green |
rebased + green-ish (same lint complaints as on master) |
if mask.any(): | ||
if not skipna: | ||
return self._na_value | ||
return self[~mask].min() |
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.
can u do
return self[~mask].min() | |
self = self[~mask] |
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.
sure. follow-up OK?
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.
sure