Closed
Description
Describe the bug
Unpacking group keys is refused in multi-columns groups, group key is wrongly assumed to be a str
To Reproduce
import pandas as pd
df = pd.DataFrame({"a": [0, 1, 2], "b": [4, 5, 6], "c": [7, 8, 9]})
for (k1, k2), g in df.groupby(["a", "b"]):
print(k1, k2)
Script output
0 4
1 5
2 6
mypy output
foo.py:5: error: Unpacking a string is disallowed
foo.py:6: error: Cannot determine type of "k1"
foo.py:6: error: Cannot determine type of "k2"
Found 3 errors in 1 file (checked 1 source file)
Please complete the following information:
- OS: Ubuntu 22.04
- python=3.9.13
- pandas=1.4.3
- pandas-stubs=1.4.3.220710
- mypy=0.961
Metadata
Metadata
Assignees
Labels
No labels