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
Provide a minimal runnable pandas example that is not properly checked by the stubs.
importpandasaspd# these values are allowedallowed= ["A", "B", "C"]
df=pd.DataFrame()
# we add a few that are not alloweddf["Column"] = ["A", "B", "C", "D"]
# replace values by index, and NA if not alloweddf["Label"] =df.Column.apply(lambdax: allowed.index(x) ifxinallowedelsepd.NA)
print(df.Label)
Indicate which type checker you are using (mypy or pyright). mypy 1.2.0 (compiled: yes)
Show the error message received from that type checker while checking your example.
bug.py:12: error: Argument 1 to "apply" of "Series" has incompatible type "Callable[[Any], Union[int, NAType]]"; expected "Callable[..., Union[str, bytes, date, datetime, timedelta, datetime64, timedelta64, bool, int, float, Timestamp, Timedelta, integer[Any], floating[Any], complex, Sequence[Any], Set[Any], Mapping[Any, Any]]]" [arg-type]
bug.py:12: error: Incompatible return value type (got "Union[int, NAType]", expected "Union[str, bytes, date, datetime, timedelta, datetime64, timedelta64, bool, int, float, Timestamp, Timedelta, integer[Any], floating[Any], complex, Sequence[Any], Set[Any], Mapping[Any, Any]]") [return-value]
Found 2 errors in 1 file (checked 1 source file)
To Reproduce
pandas
example that is not properly checked by the stubs.Indicate which type checker you are using (
mypy
orpyright
).mypy 1.2.0 (compiled: yes)
Show the error message received from that type checker while checking your example.
Please complete the following information:
pandas-stubs
: 2.0.1.230501Related: #262?
The text was updated successfully, but these errors were encountered: