Skip to content

ENH: Arithmetic operations on intervals #43629

Open
@Hoeze

Description

@Hoeze

Is 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIntervalInterval data typeNeeds DiscussionRequires discussion from core team before further actionNumeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions