BUG: idxmin() fails for nullable integer data type (Int64) · Issue #33719 · pandas-dev/pandas (original) (raw)


Code Sample

import pandas as pd

s = pd.Series([1, 2, 3, 4], dtype="Int64") s.idxmax()

Problem description

Currently, the idxmax call fails with

File "lib/python3.8/site-packages/pandas/core/series.py", line 2110, in idxmax i = nanops.nanargmax(com.values_from_object(self), skipna=skipna) File "lib/python3.8/site-packages/pandas/core/nanops.py", line 64, in _f raise TypeError( TypeError: reduction operation 'argmax' not allowed for this dtype

being raised. This may be a duplicate of #32749, although the focus there seems to be generating the exception I already encountered.

Expected Output

Should be 3, I guess.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.8.2.final.0
python-bits : 64
OS : Linux
OS-release : 5.5.13-arch2-1
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : de_DE.UTF-8
LOCALE : de_DE.UTF-8

pandas : 1.0.3
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : 2.4.4
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.2.0
numexpr : None
odfpy : None
openpyxl : 3.0.3
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : 0.8.6
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : None
numba : None
None