pandas.arrays.IntervalArray.length#
- property IntervalArray.length[source]#
Return an Index with entries denoting the length of each Interval.
The length of an interval is calculated as the difference between its right and left bounds. This property is particularly useful when working with intervals where the size of the interval is an important attribute, such as in time-series analysis or spatial data analysis.
See also
arrays.IntervalArray.left
Return the left endpoints of each Interval in the IntervalArray as an Index.
arrays.IntervalArray.right
Return the right endpoints of each Interval in the IntervalArray as an Index.
arrays.IntervalArray.mid
Return the midpoint of each Interval in the IntervalArray as an Index.
Examples
>>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)]) >>> interv_arr <IntervalArray> [(0, 1], (1, 5]] Length: 2, dtype: interval[int64, right] >>> interv_arr.length Index([1, 4], dtype='int64')