Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntervalIndex is_monotonic_decreasing is incorrect #16558

Closed
jschendel opened this issue May 31, 2017 · 1 comment
Closed

IntervalIndex is_monotonic_decreasing is incorrect #16558

jschendel opened this issue May 31, 2017 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Interval Interval data type

Comments

@jschendel
Copy link
Member

Code Sample, a copy-pastable example if possible

In [2]: idx = pd.IntervalIndex.from_tuples([(2, 3), (1, 2), (0, 1)], closed='neither')

In [3]: idx
Out[3]:
IntervalIndex([(2, 3), (1, 2), (0, 1)]
              closed='neither',
              dtype='interval[int64]')

In [4]: idx.is_monotonic_decreasing
Out[4]: False

This also incorrectly returns False for is_monotonic:

In [5]: idx.is_monotonic
Out[5]: False

However, is_non_overlapping_monotonic does correctly return True:

In [6]: idx.is_non_overlapping_monotonic
Out[6]: True

Problem description

The intervals are monotonic decreasing but the is_monotonic_decreasing and is_monotonic attributes are returning False.

Expected Output

I'd expect both is_monotonic_decreasing and is_monotonic to return True.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.20.1
pytest: 3.0.7
pip: 9.0.1
setuptools: 34.4.1
Cython: 0.25.2
numpy: 1.13.0rc2
scipy: 0.18.1
xarray: 0.9.5
IPython: 5.3.0
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: 1.4.4
bottleneck: 1.2.0
tables: 3.4.2
numexpr: 2.6.1
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.0
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: 3.7.3
bs4: None
html5lib: None
sqlalchemy: 1.1.10
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: 0.1.6
pandas_datareader: 0.4.0

@jschendel
Copy link
Member Author

Looks like this is a dupe of #16554. I initially thought they were distinct issues, as a MultiIndex isn't explicitly being used, but it looks like the IntervalIndex version of is_monotonic_decreasing just borrows the MultiIndex version though _multiindex.

@jreback jreback added Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Interval Interval data type labels May 31, 2017
@jreback jreback added this to the No action milestone May 31, 2017
@jreback jreback closed this as completed May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves Interval Interval data type
Projects
None yet
Development

No branches or pull requests

2 participants