You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Indicate which type checker you are using (mypy or pyright).
mypy
Show the error message received from that type checker while checking your example.
note: Revealed type is "Union[pandas.core.series.Series[Any], pandas.core.frame.DataFrame]"
note: Revealed type is "pandas.core.series.TimestampSeries"
Please complete the following information:
OS: Windows
OS Version: 10
python version: 3.11
version of type checker: 1.8.0
version of installed pandas-stubs: 2.2.0.240218
The text was updated successfully, but these errors were encountered:
issue877.py:4:13 - information: Type of "df1" is "Series[Unknown]"
issue877.py:5:4 - error: Unnecessary isinstance call; "Series[Unknown]" is always an instance of "Series[Unknown]" (reportUnnecessaryIsInstance)
issue877.py:6:17 - information: Type of "df1" is "Series[Unknown]"
I am unable to reproduce this one, used the same example as @tvdboom above and this is what mypy returns to me:
===========================================
Beginning: 'Run mypy on 'tests' (using the local stubs) and on the local stubs'
===========================================
tests/test_frame.py:3584: note: Revealed type is "Union[pandas.core.series.Series[Any], pandas.core.frame.DataFrame]"
tests/test_frame.py:3586: note: Revealed type is "pandas.core.series.Series[builtins.float]"
Not sure exactly where it got fixed but it seems like it does not map to TimestampSeries anymore.
It's still an issue, because what happens now is that it is picking up the first overload for Series.__new__(), which returns a Series[float]. The first reveal_type() showed that the Union contained Series[Any], and you'd expect the same from the second reveal_type().
Describe the bug
A pd.Series variable changes type after an isinstance check.
To Reproduce
pandas
example that is not properly checked by the stubs.mypy
orpyright
).mypy
Please complete the following information:
pandas-stubs
: 2.2.0.240218The text was updated successfully, but these errors were encountered: