72
72
import pandas .core .nanops as nanops
73
73
import pandas .io .formats .format as fmt
74
74
from pandas .util ._decorators import (
75
- Appender , deprecate , deprecate_kwarg , Substitution )
75
+ Appender , deprecate_kwarg , Substitution )
76
76
from pandas .util ._validators import validate_bool_kwarg
77
77
78
78
from pandas ._libs import index as libindex , tslib as libts , lib , iNaT
@@ -1239,7 +1239,7 @@ def duplicated(self, keep='first'):
1239
1239
1240
1240
def idxmin (self , axis = None , skipna = True , * args , ** kwargs ):
1241
1241
"""
1242
- Index of first occurrence of minimum of values.
1242
+ Label of first occurrence of minimum of values.
1243
1243
1244
1244
Parameters
1245
1245
----------
@@ -1259,15 +1259,14 @@ def idxmin(self, axis=None, skipna=True, *args, **kwargs):
1259
1259
DataFrame.idxmin
1260
1260
numpy.ndarray.argmin
1261
1261
"""
1262
- skipna = nv .validate_argmin_with_skipna (skipna , args , kwargs )
1263
- i = nanops .nanargmin (_values_from_object (self ), skipna = skipna )
1262
+ i = self .argmin (axis , skipna , * args , ** kwargs )
1264
1263
if i == - 1 :
1265
1264
return np .nan
1266
1265
return self .index [i ]
1267
1266
1268
1267
def idxmax (self , axis = None , skipna = True , * args , ** kwargs ):
1269
1268
"""
1270
- Index of first occurrence of maximum of values.
1269
+ Label of first occurrence of maximum of values.
1271
1270
1272
1271
Parameters
1273
1272
----------
@@ -1287,15 +1286,62 @@ def idxmax(self, axis=None, skipna=True, *args, **kwargs):
1287
1286
DataFrame.idxmax
1288
1287
numpy.ndarray.argmax
1289
1288
"""
1290
- skipna = nv .validate_argmax_with_skipna (skipna , args , kwargs )
1291
- i = nanops .nanargmax (_values_from_object (self ), skipna = skipna )
1289
+ i = self .argmax (axis , skipna , * args , ** kwargs )
1292
1290
if i == - 1 :
1293
1291
return np .nan
1294
1292
return self .index [i ]
1295
1293
1296
- # ndarray compat
1297
- argmin = deprecate ('argmin' , idxmin )
1298
- argmax = deprecate ('argmax' , idxmax )
1294
+ def argmin (self , axis = None , skipna = True , * args , ** kwargs ):
1295
+ """
1296
+ Index of first occurrence of minimum of values.
1297
+
1298
+ Parameters
1299
+ ----------
1300
+ skipna : boolean, default True
1301
+ Exclude NA/null values
1302
+
1303
+ Returns
1304
+ -------
1305
+ idxmin : Index of minimum of values
1306
+
1307
+ Notes
1308
+ -----
1309
+ This method is the Series version of ``ndarray.argmin``.
1310
+
1311
+ See Also
1312
+ --------
1313
+ DataFrame.argmin
1314
+ numpy.ndarray.argmin
1315
+ """
1316
+ skipna = nv .validate_argmin_with_skipna (skipna , args , kwargs )
1317
+ i = nanops .nanargmin (_values_from_object (self ), skipna = skipna )
1318
+ return i
1319
+
1320
+ def argmax (self , axis = None , skipna = True , * args , ** kwargs ):
1321
+ """
1322
+ Index of first occurrence of maximum of values.
1323
+
1324
+ Parameters
1325
+ ----------
1326
+ skipna : boolean, default True
1327
+ Exclude NA/null values
1328
+
1329
+ Returns
1330
+ -------
1331
+ idxmax : Index of maximum of values
1332
+
1333
+ Notes
1334
+ -----
1335
+ This method is the Series version of ``ndarray.argmax``.
1336
+
1337
+ See Also
1338
+ --------
1339
+ DataFrame.argmax
1340
+ numpy.ndarray.argmax
1341
+ """
1342
+ skipna = nv .validate_argmax_with_skipna (skipna , args , kwargs )
1343
+ i = nanops .nanargmax (_values_from_object (self ), skipna = skipna )
1344
+ return i
1299
1345
1300
1346
def round (self , decimals = 0 , * args , ** kwargs ):
1301
1347
"""
0 commit comments