The mid
attribute of an IntervalArray
object returns the midpoints of the object's intervals as an index.
IntervalArray
is an object containing interval data such that they are closed on the same side.
The mid
attribute has the following syntax:
IntervalArray.mid
Since mid
is an attribute, it takes no parameter value.
The mid
attribute returns the midpoints of each interval in the IntervalArray
object as an index.
# A code to illustrate the mid attribute of an IntervalArray object.# importing the pandas libraryimport pandas as pd# creating the IntervalArray objecta = pd.arrays.IntervalArray([pd.Interval(0, 4), pd.Interval(1, 5)])# printing the ItervalArray objectprint(a)# obtaining the midpointsprint("This is the midpoint: ", a.mid)
IntervalArray
object, a
.a
.mid
attribute to obtain the midpoints of each interval of a
.