File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ Template for intervaltree
4
4
WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
5
5
"""
6
6
7
+ from pandas._libs.algos import is_monotonic
8
+
7
9
ctypedef fused scalar_t:
8
10
float64_t
9
11
float32_t
@@ -101,6 +103,17 @@ cdef class IntervalTree(IntervalMixin):
101
103
102
104
return self._is_overlapping
103
105
106
+ @property
107
+ def is_monotonic_increasing(self):
108
+ """
109
+ Return True if the IntervalTree is monotonic increasing (only equal or
110
+ increasing values), else False
111
+ """
112
+ values = [self.right, self.left]
113
+
114
+ sort_order = np.lexsort(values)
115
+ return is_monotonic(sort_order, False)[0]
116
+
104
117
def get_loc(self, scalar_t key):
105
118
"""Return all positions corresponding to intervals that overlap with
106
119
the given scalar key
Original file line number Diff line number Diff line change 7
7
from pandas ._config import get_option
8
8
9
9
from pandas ._libs import Timedelta , Timestamp
10
- from pandas ._libs .algos import is_monotonic
11
10
from pandas ._libs .interval import Interval , IntervalMixin , IntervalTree
12
11
from pandas .compat import add_metaclass
13
12
from pandas .util ._decorators import Appender , cache_readonly
@@ -450,10 +449,7 @@ def is_monotonic_increasing(self):
450
449
Return True if the IntervalIndex is monotonic increasing (only equal or
451
450
increasing values), else False
452
451
"""
453
- values = [self .right , self .left ]
454
-
455
- sort_order = np .lexsort (values )
456
- return is_monotonic (sort_order , False )[0 ]
452
+ return self ._engine .is_monotonic_increasing
457
453
458
454
@cache_readonly
459
455
def is_monotonic_decreasing (self ):
You can’t perform that action at this time.
0 commit comments