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
Describe the bug to_timedelta uses a list of a union argument type.
This will raise false positive errors when passing a list of a single type because list is invariant.
To Reproduce
importpandasaspdpd.to_timedelta(["1 day"])
produces:
error: Argument 1 to "to_timedelta" has incompatible type "list[str]"; expected "Union[Sequence[Union[float, timedelta]], list[Union[str, float, timedelta]], tuple[Union[str, float, timedelta], ...], range, Union[ExtensionArray, ndarray[Any, Any]], Index[Any]]" [arg-type]
note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
note: Consider using "Sequence" instead, which is covariant
Please complete the following information:
OS: Win
OS Version 10
python 3.9.7
version of type checker mypy 1.8.0
version of installed pandas-stubs 2.2.2.240603
The text was updated successfully, but these errors were encountered:
Describe the bug
to_timedelta
uses a list of a union argument type.This will raise false positive errors when passing a list of a single type because list is invariant.
To Reproduce
produces:
Please complete the following information:
pandas-stubs
2.2.2.240603The text was updated successfully, but these errors were encountered: