piso.issuperset#
- piso.issuperset(interval_array, *interval_arrays, squeeze=True)#
Indicates whether a set is a superset of one, or more, other sets.
The argument interval_array and the array elements of interval_arrays are all considered to be the sets for the purposes of this set method. 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.
The list interval_arrays must contain at least one element. The superset comparison is iteratively applied between interval_array and each array in interval_arrays. When interval_arrays contains multiple interval arrays, the return type will be a numpy array. If it contains one interval array then the result can be coerced to a single boolean using the squeeze parameter.
- Parameters
- interval_array
pandas.IntervalIndex
orpandas.arrays.IntervalArray
The first operand to which all others are compared operation.
- *interval_arraysargument list of
pandas.IntervalIndex
orpandas.arrays.IntervalArray
Must contain at least one argument.
- squeezeboolean, default True
If True, will try to coerce the return value to a single pandas.Interval. If supplied, must be done so as a keyword argument.
- interval_array
- Returns
- boolean, or
numpy.ndarray
of boolean
- boolean, or
Examples
>>> import pandas as pd >>> import piso
>>> arr1 = pd.arrays.IntervalArray.from_tuples( ... [(0, 4), (3, 6), (7, 8), (10, 12)], ... ) >>> arr2 = pd.arrays.IntervalArray.from_tuples( ... [(2, 5), (7, 8)], ... ) >>> arr3 = pd.arrays.IntervalArray.from_tuples( ... [(3, 4), (10, 11)], ... )
>>> piso.issuperset(arr1, arr2) True
>>> piso.issuperset(arr1, arr2, squeeze=False) array([ True])
>>> piso.issuperset(arr1, arr2, arr3) array([ True, True])
>>> piso.issuperset(arr2, arr3) False