Open oguzhanogreden opened 4 years ago
Can you share the errors you were seeing?
For instance, here mypy would complain that I specified to_replace
can be a list, which doesn't have a items()
method.
Here's the relevant mypy output (line numbers don't agree with upstream):
pandas/core/generic.py:6475: error: Item "List[Any]" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6475: error: Item "str" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6475: error: Item "int" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6475: error: Item "float" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6475: error: Item "bool" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6475: error: Item "None" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6476: error: 'builtins.object' object is not iterable
pandas/core/generic.py:6478: error: Cannot determine type of 'values'
pandas/core/generic.py:6514: error: Value of type "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" is not indexable
pandas/core/generic.py:6514: error: Value of type "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" is not indexable
pandas/core/generic.py:6515: error: Item "List[Any]" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6515: error: Item "str" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6515: error: Item "int" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6515: error: Item "float" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6515: error: Item "bool" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6515: error: Item "None" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "keys"
pandas/core/generic.py:6516: error: Item "List[Any]" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "keys"
pandas/core/generic.py:6516: error: Item "str" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "keys"
pandas/core/generic.py:6516: error: Item "float" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "keys"
pandas/core/generic.py:6529: error: Item "List[Any]" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6529: error: Item "str" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6529: error: Item "int" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6529: error: Item "float" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6529: error: Item "bool" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6529: error: Item "None" of "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]" has no attribute "items"
pandas/core/generic.py:6537: error: Argument 1 to "len" has incompatible type "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]"; expected "Sized"
pandas/core/generic.py:6537: error: Argument 1 to "len" has incompatible type "Union[Dict[Any, Any], Any, List[Any], str, float, Series]"; expected "Sized"
pandas/core/generic.py:6539: error: Argument 1 to "len" has incompatible type "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]"; expected "Sized"
pandas/core/generic.py:6539: error: Argument 1 to "len" has incompatible type "Union[Dict[Any, Any], Any, List[Any], str, float, Series]"; expected "Sized"
pandas/core/generic.py:6547: error: Argument "regex" to "replace_list" of "BlockManager" has incompatible type "Union[Dict[Any, Any], List[Any], str, int, float, bool, Any, Any, Any, Any, Series, None]"; expected "bool"
pandas/core/generic.py:6578: error: Item "List[Any]" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "items"
pandas/core/generic.py:6578: error: Item "str" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "items"
pandas/core/generic.py:6578: error: Item "float" of "Union[Dict[Any, Any], Any, List[Any], str, float, Series]" has no attribute "items"
Current implementation of
pandas.core.to_replace()
method won't allow type hints, as noted in #32542 . Contributor guidelines suggest a refactor in this case.