Skip to content

Commit 60b8a69

Browse files
committed
Get rid of _multiindex
1 parent cdfdd77 commit 60b8a69

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pandas/core/indexes/interval.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,16 @@ def is_monotonic_increasing(self):
448448
Return True if the IntervalIndex is monotonic increasing (only equal or
449449
increasing values), else False
450450
"""
451+
values = [self.right, self.left]
452+
453+
try:
454+
sort_order = np.lexsort(values)
455+
return Index(sort_order).is_monotonic
456+
except TypeError:
457+
458+
# we have mixed types and np.lexsort is not happy
459+
return Index(self.values).is_monotonic
460+
451461
return self._multiindex.is_monotonic_increasing
452462

453463
@cache_readonly
@@ -456,7 +466,7 @@ def is_monotonic_decreasing(self):
456466
Return True if the IntervalIndex is monotonic decreasing (only equal or
457467
decreasing values), else False
458468
"""
459-
return self._multiindex.is_monotonic_decreasing
469+
return self[::-1].is_monotonic_increasing
460470

461471
@cache_readonly
462472
def is_unique(self):

0 commit comments

Comments
 (0)