ENH: Arithmetic operations on intervals
See original GitHub issueIs your feature request related to a problem?
I would like to be able to do arithmetic operations on intervals:
a + b
:pd.Interval(3, 6) + pd.Interval(5, 7) == pd.Interval(3, 7)
a - b
:pd.Interval(3, 6) - pd.Interval(5, 7) == pd.Interval(3, 5)
[a, b].union() / np.sum([a, b])
:intervals = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 3), (2, 4), (5, 7)]) intervals.sum() == pd.arrays.IntervalArray.from_tuples([(0, 4), (5, 7)])
API breaking implications
None AFAIK, since those methods are not implemented yet
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
4.7 Interval arithmetic
Interval techniques, primarily interval Newton's methods combined with bisection to ensure convergence, have been the focus of significant attention, see for ...
Read more >(PDF) Interval Arithmetic: from Principles to Implementation
The main idea is that, given a function f (x) and representing x as an interval with a lower and upper bound, the...
Read more >Interval Ranges of Fuzzy Sets Induced by Arithmetic ... - MDPI
Based on the use of an interval range, he introduced the arithmetic operations of fuzzy sets in R by using gradual sets and...
Read more >Interval type should support intersection, union & overlaps ...
We have the Interval type in pandas, which is extremely useful, however the standard interval arithmetic operations are missing from the pandas ...
Read more >Interval arithmetic - Wikipedia
Interval arithmetic is a mathematical technique used to put bounds on rounding errors and measurement errors in mathematical computation.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Hoeze I’ve taken the above concepts with staircase and created a new package “piso” for set operations over
pandas.Interval
,pandas.arrays.IntervalArray
andpandas.IntervalIndex
.https://piso.readthedocs.io
It’s currently available through pypi. Will continue to expand the functionality over the coming weeks.
@Hoeze I developed a package called staircase which allows a lot of manipulations with intervals and is designed to be closely aligned with pandas. You may find it handy? www.staircase.dev