IntervalIndex.
set_closed
Return an IntervalArray identical to the current one, but closed on the specified side.
New in version 0.24.0.
Whether the intervals are closed on the left-side, right-side, both or neither.
Examples
>>> index = pd.arrays.IntervalArray.from_breaks(range(4)) >>> index <IntervalArray> [(0, 1], (1, 2], (2, 3]] Length: 3, closed: right, dtype: interval[int64] >>> index.set_closed('both') <IntervalArray> [[0, 1], [1, 2], [2, 3]] Length: 3, closed: both, dtype: interval[int64]