pandas.IntervalIndex.set_closed
- IntervalIndex.set_closed(*args, **kwargs)[source]
-
Return an IntervalArray identical to the current one, but 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
-
- new_index:IntervalArray
Examples
>>> index = pd.arrays.IntervalArray.from_breaks(range(4)) >>> index <IntervalArray> [(0, 1], (1, 2], (2, 3]] Length: 3, dtype: interval[int64, right] >>> index.set_closed('both') <IntervalArray> [[0, 1], [1, 2], [2, 3]] Length: 3, dtype: interval[int64, both]
© 2008–2021, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.3.4/reference/api/pandas.IntervalIndex.set_closed.html