piso
piso copied to clipboard
ENH: Support for both close
Is your feature request related to a problem?
import pandas as pd
import piso
piso.register_accessors()
arr = pd.arrays.IntervalArray.from_tuples(
[(1,5), (3,6), (2,4)], closed="both")
arr.piso.intersection()
Describe the solution you'd like
[[3, 4]]
In interval computation closed interval is a quite normal case, can you support that?
Hi John, thanks for the interest.
Piso is intended to be a stop-gap until Pandas implements similar functionality. Under the hood, piso uses Staircase to perform a lot of operations, and this approach only facilitates half-open intervals. Adding the functionality for closed, or open intervals would require a complete rewrite to move away from Staircase and towards another approach - likely Interval Trees written in C code. As such it will remain out of scope for this project.
Thanks for reply! Does pandas already milestone similar functions?
Not milestoned, but an open Issue.
I don't expect it will be actioned soon, I suspect it would require significant development to do properly.
The docs for piso.bridge say that 'both' and 'neither' are accepted:
https://piso.readthedocs.io/en/latest/reference/api/piso.bridge.html
Can we get that updated please?
Thanks for pointing that out @marade, will sort out by the end of the month when a new package is released.
Thanks. I've found piso to be very useful. I wish pandas would adopt these features and others for Intervals.