Skip to content
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

Add a way to combine two IntervalDict's #14

Closed
AlexandreDecan opened this issue Sep 18, 2019 · 2 comments
Closed

Add a way to combine two IntervalDict's #14

AlexandreDecan opened this issue Sep 18, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@AlexandreDecan
Copy link
Owner

AlexandreDecan commented Sep 18, 2019

(From #13, @msarrel):

One feature that would be useful for me is to define addition, subtraction, etc. for IntervalDict. That is if we have two IntervalDicts:

[1, 3] | [5, 7] = 1
and
[2, 4] | [6, 8] = 2

Their sum would be a single Interval Dict with three entries:

[1, 2) | [5, 6) = 1
[2, 3) | [6, 7) = 3
[3, 4] | [7, 8] = 2

The idea would be to provide a d.combine(other_d, func) that takes values from d and other_d and applies func on them for every intersecting pair of intervals (as in the example, letting the values of the non-intersecting parts of these intervals as-is).

@AlexandreDecan AlexandreDecan added the enhancement New feature or request label Sep 18, 2019
@AlexandreDecan
Copy link
Owner Author

AlexandreDecan commented Sep 25, 2019

Implemented in 27bc736, will be part of next release (1.10.0). Can already be used with pip install from git.

@AlexandreDecan
Copy link
Owner Author

Release 1.10.0 is now available on PyPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant