-
-
Notifications
You must be signed in to change notification settings - Fork 153
Open
Description
Describe the bug
The following code snippet runs and passes mypy type checking w/ pandas-stubs==2.3.2.250926 (second-latest release at time of writing). However, it fails w/ pandas-stubs==2.3.3.251201 (latest release at time of writing).
To Reproduce
- Provide a minimal runnable
pandasexample that is not properly checked by the stubs.
Code:
from datetime import UTC, datetime, timedelta
import pandas as pd
dt1 = datetime.now(UTC)
dt2 = dt1 + timedelta(seconds=5)
df = pd.DataFrame((dt1, dt2), columns=("time",))
diff = df["time"].diff()
dt = diff.dt # First error here
print(dt.total_seconds()) # Second error hereOutput when run:
0 NaN
1 5.0
Name: time, dtype: float64
- Indicate which type checker you are using (
mypyorpyright).
mypy
- Show the error message received from that type checker while checking your example.
pd.py:8: error: Argument 1 to "__get__" of "DtDescriptor" has incompatible type "Series[float]"; expected "Series[Never]" [arg-type]
pd.py:9: error: "Properties" has no attribute "total_seconds" [attr-defined]
Found 2 errors in 1 file (checked 1 source file)
Please complete the following information:
- OS: Linux
- OS Version: Arch Linux x86_64
- python version: 3.13.7
- version of type checker: mypy 1.19.0 (compiled: yes)
- version of installed
pandas-stubs: 2.3.3.251201
Additional context
$ pip list
Package Version
----------------- -----------------
librt 0.6.3
mypy 1.19.0
mypy_extensions 1.1.0
numpy 2.3.5
pandas 2.3.3
pandas-stubs 2.3.3.251201
pathspec 0.12.1
pip 25.3
python-dateutil 2.9.0.post0
pytz 2025.2
six 1.17.0
types-pytz 2025.2.0.20251108
typing_extensions 4.15.0
tzdata 2025.2
Metadata
Metadata
Assignees
Labels
No labels