@@ -1033,12 +1033,104 @@ def nsmallest(
1033
1033
result = self ._python_apply_general (f , data , not_indexed_same = True )
1034
1034
return result
1035
1035
1036
- @doc (Series .idxmin .__doc__ )
1037
1036
def idxmin (self , skipna : bool = True ) -> Series :
1037
+ """
1038
+ Return the row label of the minimum value.
1039
+
1040
+ If multiple values equal the minimum, the first row label with that
1041
+ value is returned.
1042
+
1043
+ Parameters
1044
+ ----------
1045
+ skipna : bool, default True
1046
+ Exclude NA/null values. If the entire Series is NA, the result
1047
+ will be NA.
1048
+
1049
+ Returns
1050
+ -------
1051
+ Index
1052
+ Label of the minimum value.
1053
+
1054
+ Raises
1055
+ ------
1056
+ ValueError
1057
+ If the Series is empty.
1058
+
1059
+ See Also
1060
+ --------
1061
+ numpy.argmin : Return indices of the minimum values
1062
+ along the given axis.
1063
+ DataFrame.idxmin : Return index of first occurrence of minimum
1064
+ over requested axis.
1065
+ Series.idxmax : Return index *label* of the first occurrence
1066
+ of maximum of values.
1067
+
1068
+ Examples
1069
+ --------
1070
+ >>> ser = pd.Series([1, 2, 3, 4], index=pd.DatetimeIndex(
1071
+ ... ['2023-01-01', '2023-01-15', '2023-02-01', '2023-02-15']))
1072
+ >>> ser
1073
+ 2023-01-01 1
1074
+ 2023-01-15 2
1075
+ 2023-02-01 3
1076
+ 2023-02-15 4
1077
+ dtype: int64
1078
+
1079
+ >>> ser.groupby(['a', 'a', 'b', 'b']).idxmin()
1080
+ a 2023-01-01
1081
+ b 2023-02-01
1082
+ dtype: datetime64[ns]
1083
+ """
1038
1084
return self ._idxmax_idxmin ("idxmin" , skipna = skipna )
1039
1085
1040
- @doc (Series .idxmax .__doc__ )
1041
1086
def idxmax (self , skipna : bool = True ) -> Series :
1087
+ """
1088
+ Return the row label of the maximum value.
1089
+
1090
+ If multiple values equal the maximum, the first row label with that
1091
+ value is returned.
1092
+
1093
+ Parameters
1094
+ ----------
1095
+ skipna : bool, default True
1096
+ Exclude NA/null values. If the entire Series is NA, the result
1097
+ will be NA.
1098
+
1099
+ Returns
1100
+ -------
1101
+ Index
1102
+ Label of the maximum value.
1103
+
1104
+ Raises
1105
+ ------
1106
+ ValueError
1107
+ If the Series is empty.
1108
+
1109
+ See Also
1110
+ --------
1111
+ numpy.argmax : Return indices of the maximum values
1112
+ along the given axis.
1113
+ DataFrame.idxmax : Return index of first occurrence of maximum
1114
+ over requested axis.
1115
+ Series.idxmin : Return index *label* of the first occurrence
1116
+ of minimum of values.
1117
+
1118
+ Examples
1119
+ --------
1120
+ >>> ser = pd.Series([1, 2, 3, 4], index=pd.DatetimeIndex(
1121
+ ... ['2023-01-01', '2023-01-15', '2023-02-01', '2023-02-15']))
1122
+ >>> ser
1123
+ 2023-01-01 1
1124
+ 2023-01-15 2
1125
+ 2023-02-01 3
1126
+ 2023-02-15 4
1127
+ dtype: int64
1128
+
1129
+ >>> ser.groupby(['a', 'a', 'b', 'b']).idxmax()
1130
+ a 2023-01-15
1131
+ b 2023-02-15
1132
+ dtype: datetime64[ns]
1133
+ """
1042
1134
return self ._idxmax_idxmin ("idxmax" , skipna = skipna )
1043
1135
1044
1136
@doc (Series .corr .__doc__ )
0 commit comments