idxmax
is supposed to return the index of the maximum element. However, it seems to ignore special values like infinity (pd.np.Inf
), leading to the following inconsistency:
>>> from pandas import DataFrame
>>> s = pd.Series([0,5,pd.np.Inf])
>>> s.max() == s.ix[s.idxmax()]
This snippet will return False
, since s.idxmax()
will return 1
, the index of value 5
, while s.max()
returns Inf
as expected.
Expected Output
True
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.6.4-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8
pandas: 0.18.1
nose: 1.3.6
pip: 8.1.2
setuptools: 25.1.0
Cython: None
numpy: 1.11.1
scipy: 0.14.0
statsmodels: 0.6.1
xarray: None
IPython: 5.0.0
sphinx: None
patsy: 0.4.1
dateutil: 2.4.2
pytz: 2015.2
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.4.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: 2.6.2 (dt dec pq3 ext lo64)
jinja2: 2.8
boto: None
pandas_datareader: None
Comment From: jreback
this is a dupe of #13595