IntervalIndex.from_intervals()

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.
http://pandas.pydata.org/pandas-docs/version/0.20.2/generated/pandas.IntervalIndex.from_intervals.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部