-
-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
Describe the bug
there are two overload for Series#cumprod
:
pandas-stubs/pandas-stubs/core/series.pyi
Lines 3372 to 3386 in e959fc9
def cumprod( | |
self: Series[_str], | |
axis: AxisIndex = ..., | |
skipna: _bool = ..., | |
*args: Any, | |
**kwargs: Any, | |
) -> Never: ... | |
@overload | |
def cumprod( | |
self, | |
axis: AxisIndex = ..., | |
skipna: _bool = ..., | |
*args: Any, | |
**kwargs: Any, | |
) -> Series[S1]: ... |
When the self
is Series[Any]
, according to current typing spec, first one is selected and return type become Never
unexpectedly.
(EDIT: I may be misunderstanding Step 5 of the spec. but if the second one is not eliminated at that step, resulting Any
is not convenient...)
To Reproduce
from typing import reveal_type
from pandas import Series
def f(s: Series):
reveal_type(s.cumprod())
$ mypy p.py
p.py:5: note: Revealed type is "Never"
$ pyright p.py
p.py
p.py:5:17 - information: Type of "s.cumprod()" is "Never"
0 errors, 0 warnings, 1 information
Please complete the following information:
- OS: Linux
- OS Version: Ubuntu 24.04.2
- Python: 3.12.3
- mypy 1.18.1
- pyright: 1.1.405
- pandas-stubs: 2.3.2.250827
Additional context
originally reported on microsoft/pyright#10935
Metadata
Metadata
Assignees
Labels
No labels