API: .argmax should be positional, not an alias for idxmax (original) (raw)

In #6214 it was reported that argmax changed (I think since Series didn't subclass ndarray anymore). It's sometimes useful to get the index position of the max, so it'd be nice if .argmax did that, leaving idxmax to always be label-based.

In [1]: import pandas as pd pd.Ser In [2]: s = pd.Series([1, 2, 3, 0], index=['a', 'b', 'c', 'd'])

In [3]: s.idxmax() Out[3]: 'c'

In [4]: s.argmax() Out[4]: 'c'

I would expect Out[4] to be 2. The current workaround is np.argmax(x), which is OK, but doesn't generalize to DataFrames well.

We could deprecate .argmax in 0.21, pointing users to .idxmax. Then later we can change .argmax to be always be positional.


Update: We've deprecated .argmax/min. Need to change the behavior next.