Closed
Description
Describe the bug
Series.apply has two overloads, the first one enumerates the possible return types of a Callable, this is missing frozenset (probably others as well).
pandas-stubs/pandas-stubs/core/series.pyi
Lines 930 to 937 in 23b35e4
To Reproduce
- Provide a minimal runnable
pandas
example that is not properly checked by the stubs.
import pandas as pd
s = pd.Series(["A", "B", "AB"])
s.apply(tuple)
s.apply(list)
s.apply(set)
s.apply(frozenset)
- Indicate which type checker you are using (
mypy
orpyright
).
mypy
- Show the error message received from that type checker while checking your example.
series-apply.py:8: error: Argument 1 to "apply" of "Series" has incompatible type "type[frozenset[Any]]"; expected "Callable[..., str | bytes | date | datetime | timedelta | datetime64 | timedelta64 | bool | int | float | Timestamp | Timedelta | complex | Sequence[Any] | set[Any] | Mapping[Any, Any] | NAType | None]" [arg-type]
Found 1 error in 1 file (checked 1 source file)
Please complete the following information:
- OS: MacOS
- OS Version 14.1.2 (23B92)
- python version 3.11.4 (pyenv managed)
- version of type checker
mypy==1.8.0
- version of installed
pandas-stubs==2.1.4.231227