piso.isdisjoint#
- piso.isdisjoint(interval_array, *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 *interval_array is the only argument 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 interval_array.
If interval_arrays is not empty then the sets are considered to be interval_array and the elements in interval_arrays. 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_array
pandas.IntervalIndex
orpandas.arrays.IntervalArray
The first (and possibly only) operand to the isdisjoint operation.
- *interval_arraysargument list of
pandas.IntervalIndex
orpandas.arrays.IntervalArray
May contain zero or more arguments.
- interval_array
- Returns
- boolean
Examples
>>> import pandas as pd >>> import piso
>>> 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)], ... )
>>> piso.isdisjoint(arr1) False
>>> piso.isdisjoint(arr2) True
>>> piso.isdisjoint(arr1, arr2) True
>>> piso.isdisjoint(arr1, arr3) False