@@ -927,16 +927,17 @@ def max(self, axis=None, skipna=True, *args, **kwargs):
927
927
nv .validate_max (args , kwargs )
928
928
return nanops .nanmax (self ._values , skipna = skipna )
929
929
930
+ @doc (op = "max" , oppose = "min" , value = "largest" )
930
931
def argmax (self , axis = None , skipna = True , * args , ** kwargs ):
931
932
"""
932
- Return int position of the largest value in the Series.
933
+ Return int position of the {value} value in the Series.
933
934
934
- If the maximum is achieved in multiple locations,
935
+ If the {op}imum is achieved in multiple locations,
935
936
the first row position is returned.
936
937
937
938
Parameters
938
939
----------
939
- axis : {None}
940
+ axis : {{ None} }
940
941
Dummy argument for consistency with Series.
941
942
skipna : bool, default True
942
943
Exclude NA/null values when showing the result.
@@ -946,21 +947,22 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs):
946
947
Returns
947
948
-------
948
949
int
949
- Row position of the maximum values .
950
+ Row position of the {op}imum value .
950
951
951
952
See Also
952
953
--------
953
- numpy.ndarray.argmax : Equivalent method for numpy arrays.
954
- Series.argmin : Similar method, but returning the minimum.
954
+ Series.arg{op} : Return position of the {op}imum value.
955
+ Series.arg{oppose} : Return position of the {oppose}imum value.
956
+ numpy.ndarray.arg{op} : Equivalent method for numpy arrays.
955
957
Series.idxmax : Return index label of the maximum values.
956
958
Series.idxmin : Return index label of the minimum values.
957
959
958
960
Examples
959
961
--------
960
962
Consider dataset containing cereal calories
961
963
962
- >>> s = pd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
963
- ... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
964
+ >>> s = pd.Series({{ 'Corn Flakes': 100.0, 'Almond Delight': 110.0,
965
+ ... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0}} )
964
966
>>> s
965
967
Corn Flakes 100.0
966
968
Almond Delight 110.0
@@ -970,8 +972,11 @@ def argmax(self, axis=None, skipna=True, *args, **kwargs):
970
972
971
973
>>> s.argmax()
972
974
2
975
+ >>> s.argmin()
976
+ 0
973
977
974
- The maximum cereal calories is in the third element,
978
+ The maximum cereal calories is the third element and
979
+ the minimum cereal calories is the first element,
975
980
since series is zero-indexed.
976
981
"""
977
982
nv .validate_minmax_axis (axis )
@@ -1019,25 +1024,8 @@ def min(self, axis=None, skipna=True, *args, **kwargs):
1019
1024
nv .validate_min (args , kwargs )
1020
1025
return nanops .nanmin (self ._values , skipna = skipna )
1021
1026
1027
+ @doc (argmax , op = "min" , oppose = "max" , value = "smallest" )
1022
1028
def argmin (self , axis = None , skipna = True , * args , ** kwargs ):
1023
- """
1024
- Return a ndarray of the minimum argument indexer.
1025
-
1026
- Parameters
1027
- ----------
1028
- axis : {None}
1029
- Dummy argument for consistency with Series.
1030
- skipna : bool, default True
1031
-
1032
- Returns
1033
- -------
1034
- numpy.ndarray
1035
-
1036
- See Also
1037
- --------
1038
- numpy.ndarray.argmin : Return indices of the minimum values along
1039
- the given axis.
1040
- """
1041
1029
nv .validate_minmax_axis (axis )
1042
1030
nv .validate_argmax_with_skipna (skipna , args , kwargs )
1043
1031
return nanops .nanargmin (self ._values , skipna = skipna )
0 commit comments