piso.register_accessors#

piso.register_accessors()#

When called this function will register the “piso” ArrayAccessor on pandas.IntervalIndex and pandas.arrays.IntervalArray.

Examples

>>> import piso
>>> piso.register_accessors()
>>> arr = pd.arrays.IntervalArray.from_tuples(
...     [(0, 4), (2, 5), (3, 6), (7, 8), (8, 9), (10, 12)],
... )
>>> arr.piso.union()
<IntervalArray>
[(0.0, 6.0], (7.0, 9.0], (10.0, 12.0]]
Length: 3, closed: right, dtype: interval[float64]
>>> arr = pd.IntervalIndex(arr)
>>> arr.piso.union()
IntervalIndex([(0.0, 2.0], (5.0, 6.0], (7.0, 9.0], (10.0, 12.0]],
            closed='right',
            dtype='interval[float64]')