pandas.IntervalIndex.is_overlapping¶
-
IntervalIndex.
is_overlapping
¶ Return True if the IntervalIndex has overlapping intervals, else False.
Two intervals overlap if they share a common point, including closed endpoints. Intervals that only have an open endpoint in common do not overlap.
New in version 0.24.0.
Returns: - bool
Boolean indicating if the IntervalIndex has overlapping intervals.
See also
Interval.overlaps
- Check whether two Interval objects overlap.
IntervalIndex.overlaps
- Check an IntervalIndex elementwise for overlaps.
Examples
>>> index = pd.IntervalIndex.from_tuples([(0, 2), (1, 3), (4, 5)]) >>> index IntervalIndex([(0, 2], (1, 3], (4, 5]], closed='right', dtype='interval[int64]') >>> index.is_overlapping True
Intervals that share closed endpoints overlap:
>>> index = pd.interval_range(0, 3, closed='both') >>> index IntervalIndex([[0, 1], [1, 2], [2, 3]], closed='both', dtype='interval[int64]') >>> index.is_overlapping True
Intervals that only have an open endpoint in common do not overlap:
>>> index = pd.interval_range(0, 3, closed='left') >>> index IntervalIndex([[0, 1), [1, 2), [2, 3)], closed='left', dtype='interval[int64]') >>> index.is_overlapping False