piso.interval.intersection#
- piso.interval.intersection(interval1, interval2, squeeze=True)#
Performs the intersection of two
pandas.Interval
- Parameters
- interval1pandas.Interval
the first operand
- interval2pandas.Interval
the second operand
- squeezeboolean, default True
If True, will try to coerce the return value to a
pandas.Interval
- Returns
Examples
>>> import pandas as pd >>> import piso.interval
>>> piso.interval.intersection( ... pd.Interval(0, 3), ... pd.Interval(2, 4), ... ) Interval(2.0, 3.0, closed='right')
>>> piso.interval.intersection( ... pd.Interval(0, 3), ... pd.Interval(2, 4), ... squeeze=False, ... ) <IntervalArray> [(2.0, 3.0]] Length: 1, closed: right, dtype: interval[float64]
>>> piso.interval.intersection( ... pd.Interval(0, 3, closed="left"), ... pd.Interval(2, 4, closed="left"), ... ) Interval(2.0, 3.0, closed='left')
>>> piso.interval.intersection( ... pd.Interval(0, 1), ... pd.Interval(3, 4), ... ) <IntervalArray> [] Length: 0, closed: right, dtype: interval[int64]