pandas.IntervalIndex.from_intervals

classmethod IntervalIndex.from_intervals(data, name=None, copy=False) [source]

Construct an IntervalIndex from a 1d array of Interval objects

Parameters:

data : array-like (1-dimensional)

Array of Interval objects. All intervals must be closed on the same sides.

name : object, optional

Name to be stored in the index.

copy : boolean, default False

by-default copy the data, this is compat only and ignored

Examples

>>> IntervalIndex.from_intervals([Interval(0, 1), Interval(1, 2)])
IntervalIndex(left=[0, 1],
              right=[1, 2],
              closed='right')

The generic Index constructor work identically when it infers an array of all intervals:

>>> Index([Interval(0, 1), Interval(1, 2)])
IntervalIndex(left=[0, 1],
              right=[1, 2],
              closed='right')

© 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.20.3/generated/pandas.IntervalIndex.from_intervals.html