W3cubDocs

/pandas 0.25

pandas.IntervalIndex.set_closed

IntervalIndex.set_closed(self, closed) [source]

Return an IntervalIndex identical to the current one, but closed on the specified side

New in version 0.24.0.

Parameters:
closed : {‘left’, ‘right’, ‘both’, ‘neither’}

Whether the intervals are closed on the left-side, right-side, both or neither.

Returns:
new_index : IntervalIndex

Examples

>>> index = pd.interval_range(0, 3)
>>> index
IntervalIndex([(0, 1], (1, 2], (2, 3]],
      closed='right',
      dtype='interval[int64]')
>>> index.set_closed('both')
IntervalIndex([[0, 1], [1, 2], [2, 3]],
      closed='both',
      dtype='interval[int64]')

© 2008–2012, 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/0.25.0/reference/api/pandas.IntervalIndex.set_closed.html