-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Changes from all commits
e184aa4
66f1f5e
3c69f1a
fbe3b13
7380e43
d731f6a
a1aa025
e359ac7
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 | ||||
---|---|---|---|---|---|---|
|
@@ -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): | ||||||
nv.validate_minmax_axis(axis, self.ndim) | ||||||
|
||||||
if not len(self): | ||||||
return self._na_value | ||||||
|
||||||
mask = self.isna() | ||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more. can u do
Suggested change
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. sure. follow-up OK? 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. sure |
||||||
|
||||||
indexer = self.argsort()[0] | ||||||
return self[indexer] | ||||||
|
||||||
def max(self, *, axis: int | None = None, skipna: bool = True): | ||||||
nv.validate_minmax_axis(axis, self.ndim) | ||||||
|
||||||
if not len(self): | ||||||
return self._na_value | ||||||
|
||||||
mask = self.isna() | ||||||
if mask.any(): | ||||||
if not skipna: | ||||||
return self._na_value | ||||||
return self[~mask].max() | ||||||
|
||||||
indexer = self.argsort()[-1] | ||||||
return self[indexer] | ||||||
|
||||||
def fillna( | ||||||
self: IntervalArrayT, value=None, method=None, limit=None | ||||||
) -> IntervalArrayT: | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.