@@ -1326,18 +1326,26 @@ def duplicated(self, keep='first'):
1326
1326
1327
1327
def idxmin (self , axis = None , skipna = True , * args , ** kwargs ):
1328
1328
"""
1329
- Index *label* of the first occurrence of minimum of values.
1329
+ Index label of the first occurrence of minimum of values.
1330
+
1331
+ Look for the first occurence of maximum of values and return the
1332
+ index label. When data contains NA/null values, return nan.
1330
1333
1331
1334
Parameters
1332
1335
----------
1333
1336
skipna : boolean, default True
1334
1337
Exclude NA/null values. If the entire Series is NA, the result
1335
1338
will be NA.
1339
+ axis : int, default 0
1340
+ Redundant for application on series.
1341
+ *args, **kwargs :
1342
+ Additional keywors have no effect but might be accepted
1343
+ for compatibility with numpy.
1336
1344
1337
1345
Raises
1338
1346
------
1339
1347
ValueError
1340
- * If the Series is empty
1348
+ If the Series is empty
1341
1349
1342
1350
Returns
1343
1351
-------
@@ -1351,29 +1359,57 @@ def idxmin(self, axis=None, skipna=True, *args, **kwargs):
1351
1359
1352
1360
See Also
1353
1361
--------
1354
- DataFrame.idxmin
1355
- numpy.ndarray.argmin
1362
+ numpy.ndarray.argmin : Return indices of the minimum values
1363
+ along the given axis.
1364
+ DataFrame.idxmin : Return index of first occurrence of minimum
1365
+ over requested axis.
1366
+ Series.idxmax : Return index *label* of the first occurrence
1367
+ of maximum of values.
1368
+
1369
+ Examples
1370
+ --------
1371
+ >>> s = pd.Series(data=[1,None,4,1], index=['A','B','C','D'])
1372
+ >>> s
1373
+ A 1.0
1374
+ B NaN
1375
+ C 4.0
1376
+ D 1.0
1377
+ dtype: float64
1378
+
1379
+ >>> s.idxmin()
1380
+ 'A'
1381
+
1382
+ s.idxmin(skipna=False)
1383
+ nan
1356
1384
"""
1357
1385
skipna = nv .validate_argmin_with_skipna (skipna , args , kwargs )
1358
1386
i = nanops .nanargmin (com ._values_from_object (self ), skipna = skipna )
1359
1387
if i == - 1 :
1360
1388
return np .nan
1361
1389
return self .index [i ]
1362
1390
1363
- def idxmax (self , axis = None , skipna = True , * args , ** kwargs ):
1391
+ def idxmax (self , axis = 0 , skipna = True , * args , ** kwargs ):
1364
1392
"""
1365
- Index *label* of the first occurrence of maximum of values.
1393
+ Return index label of the first occurrence of maximum of values.
1394
+
1395
+ Look for the first occurence of maximum of values and return the
1396
+ index label. When data contains NA/null values, return nan.
1366
1397
1367
1398
Parameters
1368
1399
----------
1369
1400
skipna : boolean, default True
1370
1401
Exclude NA/null values. If the entire Series is NA, the result
1371
1402
will be NA.
1403
+ axis : int, default 0
1404
+ Redundant for application on series.
1405
+ *args, **kwargs :
1406
+ Additional keywors have no effect but might be accepted
1407
+ for compatibility with numpy.
1372
1408
1373
1409
Raises
1374
1410
------
1375
1411
ValueError
1376
- * If the Series is empty
1412
+ If the Series is empty
1377
1413
1378
1414
Returns
1379
1415
-------
@@ -1387,8 +1423,29 @@ def idxmax(self, axis=None, skipna=True, *args, **kwargs):
1387
1423
1388
1424
See Also
1389
1425
--------
1390
- DataFrame.idxmax
1391
- numpy.ndarray.argmax
1426
+ numpy.ndarray.argmax : Return indices of the maximum values
1427
+ along the given axis.
1428
+ DataFrame.idxmax : Return index of first occurrence of maximum
1429
+ over requested axis.
1430
+ Series.idxmin : Return index *label* of the first occurrence
1431
+ of minimum of values.
1432
+
1433
+ Examples
1434
+ --------
1435
+ >>> s = pd.Series(data=[1,None,4,3,4], index=['A','B','C','D','E'])
1436
+ >>> s
1437
+ A 1.0
1438
+ B NaN
1439
+ C 4.0
1440
+ D 3.0
1441
+ E 4.0
1442
+ dtype: float64
1443
+
1444
+ >>> s.idxmax()
1445
+ 'C'
1446
+
1447
+ s.idxmax(skipna=False)
1448
+ nan
1392
1449
"""
1393
1450
skipna = nv .validate_argmax_with_skipna (skipna , args , kwargs )
1394
1451
i = nanops .nanargmax (com ._values_from_object (self ), skipna = skipna )
0 commit comments