pandas.arrays.IntervalArray.mid#

property IntervalArray.mid[source]#

Return the midpoint of each Interval in the IntervalArray as an Index.

The midpoint of an interval is calculated as the average of its left and right bounds. This property returns a pandas.Index object containing the midpoint for each interval.

See also

Interval.left

Return left bound for the interval.

Interval.right

Return right bound for the interval.

Interval.length

Return the length of each interval.

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.mid
Index([0.5, 3.0], dtype='float64')