Skip to content

BUG: Unable to add np.timedelta64 + pd.Interval(pd.Timestamp, pd.Timestamp) #35961

Closed
@dsaxton

Description

@dsaxton

Note: this is currently not a bug on master but will be after #35938, which reverts a change that caused other regressions.

import numpy as np
import pandas as pd

delta = np.timedelta64(0)
interval = pd.Interval(pd.Timestamp("2020-01-01"), pd.Timestamp("2020-02-01"))
delta + interval
UFuncTypeError                            Traceback (most recent call last)
<ipython-input-1-2c3b3a0b4fb8> in <module>
      4 delta = np.timedelta64(0)
      5 interval = pd.Interval(pd.Timestamp("2020-01-01"), pd.Timestamp("2020-02-01"))
----> 6 delta + interval

UFuncTypeError: ufunc 'add' cannot use operands with types dtype('<m8') and dtype('O')

Flipping the operands however works

interval + delta
Interval('2020-01-01', '2020-02-01', closed='right')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions