The piso accessors#
Applying set operations to interval array objects: pandas.arrays.Interval
and pandas.IntervalIndex
can be done with top-level functions:
The exact same functionality is available through accessors on these classes. Using accessors allows us to extend the functionality associated with these classes, without adding the methods directly. Before the accessors can be used they must be registered:
In [1]: import piso
In [2]: piso.register_accessors()
Registering the accessors adds a piso property to the classes which can be used like so:
In [3]: arr = pd.arrays.IntervalArray.from_tuples(
...: [(1,5), (3,6), (2,4)]
...: )
...:
In [4]: arr.piso.intersection()
Out[4]:
<IntervalArray>
[(3, 4]]
Length: 1, dtype: interval[int64, right]
Further examples using the piso accessors can be found in the API reference.