Closed
Description
Describe the bug
core.groupby.generic.DataFrameGroupBy
missing keyword-only arguments
To Reproduce
- Provide a minimal runnable
pandas
example that is not properly checked by the stubs. - Indicate which type checker you are using (
mypy
orpyright
). - Show the error message received from that type checker while checking your example.
Current:
DataFrameGroupBy().aggregate("size", "some", "args", engine=0, engine_kwargs="not valid", other_kwarg="")
# no error despite `engine` as `engine_kwargs` not being valid types for those kw-only args
Expected:
mypy
error: No overload variant of "aggregate" of "DataFrameGroupBy" matches argument types "str", "str", "str", "int", "int", "str" [call-overload]
note: Possible overload variants:
note: def aggregate(self, arg: Literal['size']) -> Series[Any]
note: def aggregate(self, arg: Union[Union[Callable[..., Any], str, ufunc], list[Union[Callable[..., Any], str, ufunc]], Mapping[Any, Union[Union[Callable[..., Any], str, ufunc], list[Union[Callable[...,
Any], str, ufunc]]]]] = ..., *args: Any, engine: Optional[str] = ..., engine_kwargs: Optional[dict[str, bool]] = ..., **kwargs: Any) -> DataFrame
pyright
error: Argument of type "Literal[0]" cannot be assigned to parameter "engine" of type "str | None" in function "aggregate"
Type "Literal[0]" cannot be assigned to type "str | None"
"Literal[0]" is incompatible with "str"
Type cannot be assigned to type "None" (reportGeneralTypeIssues)
error: Argument of type "Literal[0]" cannot be assigned to parameter "engine_kwargs" of type "dict[str, bool] | None" in function "aggregate"
Type "Literal[0]" cannot be assigned to type "dict[str, bool] | None"
"Literal[0]" is incompatible with "dict[str, bool]"
Type cannot be assigned to type "None" (reportGeneralTypeIssues)
Please complete the following information:
- OS: Windows
- OS Version 10.0.19045 Build 19045
- python version: 3.9.13
- version of type checker:
- mypy 1.6.1 (compiled: yes)
- pyright@1.1.334
- version of installed
pandas-stubs
: 2.1.1.230928
Additional context
Noticed while drilling down seaborn types to complete some method signatures in typeshed