piso.accessor.ArrayAccessor.isdisjoint#

ArrayAccessor.isdisjoint(*interval_arrays)#

Indicates whether one, or more, sets are disjoint or not.

interval_array must be left-closed or right-closed if *interval_arrays is non-empty. If no arguments are provided then this restriction does not apply.

What is considered a set is determined by the number of positional arguments used, that is, determined by the size of interval_arrays.

If interval_arrays is empty then the sets are considered to be the intervals contained in the array object the accessor belongs to (an instance of pandas.IntervalIndex, pandas.arrays.IntervalArray).

If interval_arrays is not empty then the sets are considered to be the elements in interval_arrays, in addition to the intervals in the array object the accessor belongs to. Each of these arrays is assumed to contain disjoint intervals (and satisfy the definition of a set). Any array containing overlaps between intervals will be mapped to one with disjoint intervals via a union operation.

Parameters
*interval_arraysargument list of pandas.IntervalIndex or pandas.arrays.IntervalArray

May contain zero or more arguments.

Returns
boolean

Examples

>>> import pandas as pd
>>> import piso
>>> piso.register_accessors()
>>> arr1 = pd.arrays.IntervalArray.from_tuples(
...     [(0, 3), (2, 4)],
... )
>>> arr2 = pd.arrays.IntervalArray.from_tuples(
...     [(4, 7), (8, 11)],
... )
>>> arr3 = pd.arrays.IntervalArray.from_tuples(
...     [(2, 4), (7, 8)],
... )
>>> arr1.piso.isdisjoint()
False
>>> arr2.piso.isdisjoint()
True
>>> arr1.piso.isdisjoint(arr2)
True
>>> arr1.piso.isdisjoint(arr3)
False