Not a problem. Just a feature I would have liked to have! :-)
I would like to be able to know if an Interval
is contained into another Interval
.
e.g. [2, 3)
is contained in [2, 4)
but not in (2, 4]
Something like this
def interval_contains(a: pd.Interval, b: pd.Interval) -> bool: res = a.left <= b.left and a.right >= b.right if a.open_left and b.closed_left: res &= a.left < b.left if a.open_right and b.closed_right: res &= a.right > b.right return resAPI breaking implications
Currently, if you do something like this
a = pd.Interval(2, 3, closed="left") b = pd.Interval(2, 4, closed="left") print(a in b)
it raises the following exception
TypeError: __contains__ not defined for two intervals
Adding support for another type of object in __contains__
would not break the API, but just extend it.
Could not find any.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4