Skip to content

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

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

Closed
dsaxton opened this issue Aug 28, 2020 · 0 comments
Closed
Labels
Bug Datetime Datetime data dtype Interval Interval data type

Comments

@dsaxton
Copy link
Member

dsaxton commented Aug 28, 2020

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')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype Interval Interval data type
Projects
None yet
Development

No branches or pull requests

1 participant