pandas.Series.interval#

Series.interval()[source]#

Accessor object for interval properties of the Series values.

Provides the endpoints, midpoints and lengths of the intervals, and elementwise checks for containment and overlap, each returned as a Series aligned with the original. A categorical Series with interval categories, such as the result of cut(), is also supported.

Parameters:
dataSeries

The Series with interval or interval-categorical dtype to which the accessor is attached.

See also

arrays.IntervalArray

Pandas array for interval data.

Series.cat

Accessor object for categorical properties of the Series values.

Series.dt

Accessor object for datetimelike properties of the Series values.

Examples

>>> ser = pd.Series(pd.arrays.IntervalArray.from_breaks([0, 1, 3, 6]))
>>> ser.interval.mid
0    0.5
1    2.0
2    4.5
dtype: float64
>>> ser.interval.contains(2)
0    False
1     True
2    False
dtype: bool