@@ -927,22 +927,50 @@ def max(self, axis=None, skipna=True, *args, **kwargs):
927
927
928
928
def argmax (self , axis = None , skipna = True , * args , ** kwargs ):
929
929
"""
930
- Return an ndarray of the maximum argument indexer.
930
+ Return int position of the largest value in the Series.
931
+
932
+ If the maximum is achieved in multiple locations,
933
+ the first row position is returned.
931
934
932
935
Parameters
933
936
----------
934
937
axis : {None}
935
938
Dummy argument for consistency with Series.
936
939
skipna : bool, default True
940
+ Exclude NA/null values when showing the result.
941
+ *args, **kwargs
942
+ Additional arguments and keywords for compatibility with NumPy.
937
943
938
944
Returns
939
945
-------
940
- numpy.ndarray
941
- Indices of the maximum values.
946
+ int
947
+ Row position of the maximum values.
942
948
943
949
See Also
944
950
--------
945
- numpy.ndarray.argmax
951
+ numpy.ndarray.argmax : Equivalent method for numpy arrays.
952
+ Series.argmin : Similar method, but returning the minimum.
953
+ Series.idxmax : Return index label of the maximum values.
954
+ Series.idxmin : Return index label of the minimum values.
955
+
956
+ Examples
957
+ --------
958
+ Consider dataset containing cereal calories
959
+
960
+ >>> s = pd.Series({'Corn Flakes': 100.0, 'Almond Delight': 110.0,
961
+ ... 'Cinnamon Toast Crunch': 120.0, 'Cocoa Puff': 110.0})
962
+ >>> s
963
+ Corn Flakes 100.0
964
+ Almond Delight 110.0
965
+ Cinnamon Toast Crunch 120.0
966
+ Cocoa Puff 110.0
967
+ dtype: float64
968
+
969
+ >>> s.argmax()
970
+ 2
971
+
972
+ The maximum cereal calories is in the third element,
973
+ since series is zero-indexed.
946
974
"""
947
975
nv .validate_minmax_axis (axis )
948
976
nv .validate_argmax_with_skipna (skipna , args , kwargs )
0 commit comments