Skip to content

Commit

Permalink
Added axis for Index : argmin, argmax, min and max
Browse files Browse the repository at this point in the history
  • Loading branch information
ghraciella committed Jul 28, 2023
1 parent 3fb33d6 commit 51a69e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
ArrayLike,
Axes,
Axis,
AxisInt,
DropKeep,
DtypeObj,
F,
Expand Down Expand Up @@ -7268,7 +7269,7 @@ def _maybe_disable_logical_methods(self, opname: str_t) -> None:
make_invalid_op(opname)(self)

@Appender(IndexOpsMixin.argmin.__doc__)
def argmin(self, axis=None, skipna: bool = True, *args, **kwargs) -> int:
def argmin(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs) -> int:
nv.validate_argmin(args, kwargs)
nv.validate_minmax_axis(axis)

Expand All @@ -7287,7 +7288,7 @@ def argmin(self, axis=None, skipna: bool = True, *args, **kwargs) -> int:
return super().argmin(skipna=skipna)

@Appender(IndexOpsMixin.argmax.__doc__)
def argmax(self, axis=None, skipna: bool = True, *args, **kwargs) -> int:
def argmax(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs) -> int:
nv.validate_argmax(args, kwargs)
nv.validate_minmax_axis(axis)

Expand All @@ -7305,7 +7306,7 @@ def argmax(self, axis=None, skipna: bool = True, *args, **kwargs) -> int:
return -1
return super().argmax(skipna=skipna)

def min(self, axis=None, skipna: bool = True, *args, **kwargs):
def min(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs):
"""
Return the minimum value of the Index.
Expand Down Expand Up @@ -7368,7 +7369,7 @@ def min(self, axis=None, skipna: bool = True, *args, **kwargs):

return nanops.nanmin(self._values, skipna=skipna)

def max(self, axis=None, skipna: bool = True, *args, **kwargs):
def max(self, axis: AxisInt|None = None, skipna: bool = True, *args, **kwargs):
"""
Return the maximum value of the Index.
Expand Down

0 comments on commit 51a69e7

Please sign in to comment.