Skip to main content
`Ctrl`+`K`

# pandas.arrays.IntervalArray.set_closed

IntervalArray.set_closed(closed)

  Return an identical IntervalArray closed on the specified side.

  This method creates a new IntervalArray with the same bounds but with a different closure specification.

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

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

  Returns:
    IntervalArray

      A new IntervalArray with the specified side closures.

  See also

  `IntervalArray.closed`

    Returns inclusive side of the Interval.

  `arrays.IntervalArray.closed`

    Returns inclusive side of the 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]