Skip to content

Dividing a series of Timedeltas by a Timedelta is rejected #461

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
Dr-Irv opened this issue Dec 8, 2022 · 0 comments · Fixed by #488
Closed

Dividing a series of Timedeltas by a Timedelta is rejected #461

Dr-Irv opened this issue Dec 8, 2022 · 0 comments · Fixed by #488

Comments

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 8, 2022

Describe the bug
Should allow TimedeltaSeries / pd.Timedelta

To Reproduce

import pandas as pd

tds = pd.Series(pd.timedelta_range(start="1 day", periods=10))
td = pd.Timedelta("2 hours")

q = tds / td

pyright reports:

tddiv.py
  c:\Code\pandas-stubs\tddiv.py:6:5 - error: Operator "/" not supported for types "TimedeltaSeries" and "Timedelta"
    Operator "/" not supported for types "TimedeltaSeries" and "Timedelta" (reportGeneralTypeIssues)

Please complete the following information:

  • OS:Windows 10
  • python version: 3.9
  • version of type checker: pyright 1.1.283
  • version of installed pandas-stubs: 1.5.2.221124

Additional context

Just need to add Timedelta here:

def __truediv__(self, other: TimedeltaSeries | np.timedelta64 | TimedeltaIndex) -> Series[float]: ... # type: ignore[override]

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