pandas.IntervalIndex.is_overlapping#
- property 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.
- 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]], dtype='interval[int64, right]') >>> 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]], dtype='interval[int64, both]') >>> 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)], dtype='interval[int64, left]') >>> index.is_overlapping False