-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Features which Interval / IntervalIndex should probably have #19480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that Some more ideas, all of which should return booleans, mostly taken from postgres range types:
(see the postgres docs for examples) Another postgres function that could be nice is |
I was currently working with an IntervalIndex and needed to get the interval ranges. Maybe this would be useful for others as well?
|
@tsabsch : By If so, note that this was implemented as the In [2]: pd.__version__
Out[2]: '0.23.0.dev0+230.gf391cbf'
In [3]: pd.IntervalIndex.from_tuples([(1, 2), (5, 9)]).length
Out[3]: Int64Index([1, 4], dtype='int64') |
@jschendel Yes, this is exactly what I meant. Thank you for pointing it out. I wasn't aware that it was already implemented for the next release. I'm on pandas 0.22.0. |
@tsabsch : No worries. Glad to hear |
It might also be nice to be able to check if an |
Here's a list of possible features which should be added to the Interval and IntervalIndex types. Some of them might already exist, in which case, please excuse my mistake. Also note, I'm not asking for these, just listing some ideas I had which might be useful for others.
closest
Big question: what if there are two or more identically distant intervals?
complement
intersection
union
subtract|difference
sort
(I'm guessing this is probably already implicitly implemented. Does it work for multi-index in which one of the levels is Intervalindex?)
shift
(Could be really useful for datetimes?)
slop|grow|window|better name
The text was updated successfully, but these errors were encountered: