Closed
Description
Currently the type annotation for Index.difference is
def difference(self, other: Union[List[T1], Index]) -> Index: ...
None
values are disallowed for the other
argument if it is a list. As a result of that the following code, which runs perfectly fine, will give an error when mypy
is used to check it:
from pandas.core.indexes.api import Index
index = Index(["a", "b", "c"])
index.difference(["a", None])
I think the function type should be changed to:
def difference(self, other: Union[List[Optional[T1]], Index]) -> Index: ...
Metadata
Metadata
Assignees
Labels
No labels