pandas.IntervalIndex.set_closed — pandas 2.2.3 documentation (original) (raw)
IntervalIndex.set_closed(*args, **kwargs)[source]#
Return an identical IntervalArray closed on the specified side.
Parameters:
closed{‘left’, ‘right’, ‘both’, ‘neither’}
Whether the intervals are closed on the left-side, right-side, both or neither.
Returns:
IntervalArray
Examples
index = pd.arrays.IntervalArray.from_breaks(range(4)) index [(0, 1], (1, 2], (2, 3]] Length: 3, dtype: interval[int64, right] index.set_closed('both') [[0, 1], [1, 2], [2, 3]] Length: 3, dtype: interval[int64, both]