subtract_interval
- subtract_interval(index, other)[source]
Subtract an interval from the existing intervals.
A continuous interval index has one specific property; none of the intervals overlap. Hence, subtracting intervals from a continuous interval index has the following behavior:
- Subtracting an interval which does not overlap with the index
The interval is ignored.
- Subtracting an interval which overlaps partially with an interval in the index
The index’ interval is shortened.
- Subtracting an interval which overlaps completely with an interval in the index
The index’ interval is split in two.
- Parameters:
index (IntervalIndex) – The continuous interval index.
other (Interval) – The interval to subtract. Must have the same interval type.
- Returns:
The new index after subtracting the interval.
- Return type:
IntervalIndex