Skip to content

BUG: strange behaviour of .index.min() #6027

Closed
@dsm054

Description

@dsm054

I was expecting df.index.min() here to be equal to min(df.index), and I guess it is; but I wasn't expecting this:

>>> import pandas as pd
>>> pd.__version__
'0.13.0-268-g08c1302'
>>> df = pd.DataFrame({"A": [1]})
>>> df.index
Int64Index([0], dtype='int64')
>>> min(df.index)
0
>>> type(min(df.index))
<type 'numpy.int64'>
>>> m = df.index.min()
>>> m == 0
True
>>> type(m)
<class 'pandas.core.index.Int64Index'>
>>> m
[...]
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_268_g08c1302-py2.7-linux-i686.egg/pandas/core/common.py", line 2570, in as_escaped_unicode
    result = compat.text_type(thing)  # we should try this first
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_268_g08c1302-py2.7-linux-i686.egg/pandas/core/base.py", line 201, in __unicode__
    quote_strings=True)
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_268_g08c1302-py2.7-linux-i686.egg/pandas/core/common.py", line 2597, in pprint_thing
    elif _is_sequence(thing) and _nest_lvl < \
  File "/usr/local/lib/python2.7/dist-packages/pandas-0.13.0_268_g08c1302-py2.7-linux-i686.egg/pandas/core/common.py", line 2100, in _is_sequence
    iter(x)
RuntimeError: maximum recursion depth exceeded while calling a Python object

The same thing applies to .max().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions