Am 27.04.20 um 18:57 schrieb Graham Wheeler:
@overload def replace(self, to_replace: Optional[Any] = ..., value: Optional[Any] = ..., inplace: Literal[True], limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> None: ... @overload def replace(self, to_replace: Optional[Any] = ..., value: Optional[Any] = ..., inplace: Optional[Literal[False]] = ..., limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> DataFrame: ..
You can make this work using multiple overloads: @overload def replace(self, to_replace: Optional[Any], value: Optional[Any], inplace: Literal[True], limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> None: ... @overload def replace(self, to_replace: Optional[Any], *, value: Optional[Any] = ..., inplace: Literal[True], limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> None: ... @overload def replace(self, *, to_replace: Optional[Any] = ..., value: Optional[Any] = ..., inplace: Literal[True], limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> None: ... @overload def replace(self, to_replace: Optional[Any] = ..., value: Optional[Any] = ...,inplace: Optional[Literal[False]] = ..., limit: Optional[int] = ..., regex: _Regex = ..., method: _str = ...) -> DataFrame: .. Not particularly elegant, but it should work. - Sebastian