Closed
Description
import pandas as pd
s = pd.Series(pd.to_timedelta([1, 2, 3], "h"))
pd.Timestamp(0) + s.cumsum()
with mypy
$ mypy tmp.py
tmp.py:4:1: error: No overload variant of "__add__" of "Timestamp" matches argument type "Series[Timedelta]" [operator]
tmp.py:4:1: note: Possible overload variants:
tmp.py:4:1: note: def __add__(self, ndarray[tuple[int, ...], dtype[timedelta64[timedelta | int | None]]], /) -> ndarray[tuple[int, ...], dtype[datetime64[date | int | None]]]
tmp.py:4:1: note: def __add__(self, timedelta | timedelta64[timedelta | int | None] | Tick, /) -> Timestamp
tmp.py:4:1: note: def __add__(self, TimedeltaSeries, /) -> TimestampSeries
tmp.py:4:1: note: def __add__(self, TimedeltaIndex, /) -> DatetimeIndex
Found 1 error in 1 file (checked 1 source file)
with pyright
$ pyright tmp.py
/home/rscholz/github/randolf-scholz/tsdm/tmp.py
/home/rscholz/github/randolf-scholz/tsdm/tmp.py:4:1 - error: Operator "+" not supported for types "Timestamp" and "Series[Timedelta]" (reportOperatorIssue)
/home/rscholz/github/randolf-scholz/tsdm/tmp.py:4:1 - warning: Expression value is unused (reportUnusedExpression)
1 error, 1 warning, 0 informations
mypy 1.16.0
mypy_extensions 1.1.0
pandas 2.3.0
pandas-stubs 2.2.3.250527
pyright 1.1.401