Skip to content

Series arithmetic methods accepting a Timedelta should also accept a np.timedelta64 #423

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
gandhis1 opened this issue Nov 10, 2022 · 1 comment · Fixed by #432
Closed

Comments

@gandhis1
Copy link
Contributor

gandhis1 commented Nov 10, 2022

import numpy as np
import pandas as pd

s1 = pd.Series(data=pd.date_range("1/1/2020", "2/1/2020"))
s2 = pd.Series(data=pd.date_range("1/1/2021", "2/1/2021"))
s3 = (s1 - s2) / np.timedelta64(1, "M")  # pd.Series[float]

error: No overload variant of "__truediv__" of "Series" matches argument type "timedelta64" [operator]

This applies to most arithmetic methods that accept a Timedelta

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Nov 10, 2022

There's a couple of issues here. One is that we do need to add np.timedetla64 as accepted in different arithmetic methods for Series. But we should also add a __truediv__() method for TimestampSeries, as well as the other arithmetic operators that accept either a pd.Timedelta or np.timedelta64

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

Successfully merging a pull request may close this issue.

2 participants