68
68
import pandas .core .common as com
69
69
import pandas .core .nanops as nanops
70
70
import pandas .io .formats .format as fmt
71
- from pandas .util ._decorators import Appender , deprecate_kwarg , Substitution
71
+ from pandas .util ._decorators import (
72
+ Appender , deprecate , deprecate_kwarg , Substitution )
72
73
from pandas .util ._validators import validate_bool_kwarg
73
74
74
75
from pandas ._libs import index as libindex , tslib as libts , lib , iNaT
@@ -1271,7 +1272,7 @@ def duplicated(self, keep='first'):
1271
1272
1272
1273
def idxmin (self , axis = None , skipna = True , * args , ** kwargs ):
1273
1274
"""
1274
- Index of first occurrence of minimum of values.
1275
+ Index *label* of the first occurrence of minimum of values.
1275
1276
1276
1277
Parameters
1277
1278
----------
@@ -1284,7 +1285,9 @@ def idxmin(self, axis=None, skipna=True, *args, **kwargs):
1284
1285
1285
1286
Notes
1286
1287
-----
1287
- This method is the Series version of ``ndarray.argmin``.
1288
+ This method is the Series version of ``ndarray.argmin``. This method
1289
+ returns the label of the minimum, while ``ndarray.argmin`` returns
1290
+ the position. To get the position, use ``series.values.argmin()``.
1288
1291
1289
1292
See Also
1290
1293
--------
@@ -1299,7 +1302,7 @@ def idxmin(self, axis=None, skipna=True, *args, **kwargs):
1299
1302
1300
1303
def idxmax (self , axis = None , skipna = True , * args , ** kwargs ):
1301
1304
"""
1302
- Index of first occurrence of maximum of values.
1305
+ Index *label* of the first occurrence of maximum of values.
1303
1306
1304
1307
Parameters
1305
1308
----------
@@ -1312,7 +1315,9 @@ def idxmax(self, axis=None, skipna=True, *args, **kwargs):
1312
1315
1313
1316
Notes
1314
1317
-----
1315
- This method is the Series version of ``ndarray.argmax``.
1318
+ This method is the Series version of ``ndarray.argmax``. This method
1319
+ returns the label of the maximum, while ``ndarray.argmax`` returns
1320
+ the position. To get the position, use ``series.values.argmax()``.
1316
1321
1317
1322
See Also
1318
1323
--------
@@ -1326,8 +1331,18 @@ def idxmax(self, axis=None, skipna=True, *args, **kwargs):
1326
1331
return self .index [i ]
1327
1332
1328
1333
# ndarray compat
1329
- argmin = idxmin
1330
- argmax = idxmax
1334
+ argmin = deprecate ('argmin' , idxmin ,
1335
+ msg = "'argmin' is deprecated. Use 'idxmin' instead. "
1336
+ "The behavior of 'argmin' will be corrected to "
1337
+ "return the positional minimum in the future. "
1338
+ "Use 'series.values.argmin' to get the position of "
1339
+ "the minimum now." )
1340
+ argmax = deprecate ('argmax' , idxmax ,
1341
+ msg = "'argmax' is deprecated. Use 'idxmax' instead. "
1342
+ "The behavior of 'argmax' will be corrected to "
1343
+ "return the positional maximum in the future. "
1344
+ "Use 'series.values.argmax' to get the position of "
1345
+ "the maximum now." )
1331
1346
1332
1347
def round (self , decimals = 0 , * args , ** kwargs ):
1333
1348
"""
0 commit comments