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
Indicate which type checker you are using (mypy or pyright).
mypy
Show the error message received from that type checker while checking your example. get_pandas_loc.py:11: error: Invalid index type "tuple[slice, slice | tuple[str | list[str | builtins.bool] | slice, ...] | list[str | builtins.bool | tuple[str | list[str | builtins.bool] | slice, ...]]]" for "_LocIndexerFrame"; expected type "slice | ndarray[Any, dtype[integer[Any]]] | Index[Any] | list[int] | Series[int] | <6 more items>" [index]
Please complete the following information:
OS: Windows
OS Version [e.g. 22]: 11
python version: 3.10.15
version of type checker: mypy 2.1.2
version of installed pandas-stubs: 2.2.3.241009
Additional context
version of pandas: 2.2.3
mypy option: strict=True
The text was updated successfully, but these errors were encountered:
There are a couple of issues here. First, from a typing perspective, you are getting mismatches because your declaration of the parameter key in the function df_loc doesn't match the way that pandas-stubs declares such arguments. If you eliminate that function, and then use the following in your tests:
Describe the bug
When values are extracted from a data frame with a multi-index, the key is supposed to be an accepted tuple, but it is not.
To Reproduce
pandas
example that is not properly checked by the stubs.mypy
orpyright
).mypy
get_pandas_loc.py:11: error: Invalid index type "tuple[slice, slice | tuple[str | list[str | builtins.bool] | slice, ...] | list[str | builtins.bool | tuple[str | list[str | builtins.bool] | slice, ...]]]" for "_LocIndexerFrame"; expected type "slice | ndarray[Any, dtype[integer[Any]]] | Index[Any] | list[int] | Series[int] | <6 more items>" [index]
Please complete the following information:
pandas-stubs
: 2.2.3.241009Additional context
pandas
: 2.2.3strict=True
The text was updated successfully, but these errors were encountered: