File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1189,7 +1189,9 @@ class DataFrame(NDFrame, OpsMixin):
1189
1189
@property
1190
1190
def columns (self ) -> Index : ...
1191
1191
@columns .setter # setter needs to be right next to getter; otherwise mypy complains
1192
- def columns (self , cols : list [_str ] | Index [_str ]) -> None : ... # type: ignore[type-arg]
1192
+ def columns (
1193
+ self , cols : AnyArrayLike | list [HashableT ] | tuple [HashableT , ...]
1194
+ ) -> None : ...
1193
1195
@property
1194
1196
def dtypes (self ) -> Series : ...
1195
1197
@property
Original file line number Diff line number Diff line change @@ -1408,6 +1408,14 @@ def test_set_columns() -> None:
1408
1408
# https://github.com/python/mypy/issues/3004
1409
1409
# pyright doesn't need the ignore
1410
1410
df .columns = ["c" , "d" ] # type: ignore[assignment]
1411
+ df .columns = [1 , 2 ] # type: ignore[assignment]
1412
+ df .columns = [1 , "a" ] # type: ignore[assignment]
1413
+ df .columns = np .array ([1 , 2 ]) # type: ignore[assignment]
1414
+ df .columns = pd .Series ([1 , 2 ]) # type: ignore[assignment]
1415
+ df .columns = np .array ([1 , "a" ]) # type: ignore[assignment]
1416
+ df .columns = pd .Series ([1 , "a" ]) # type: ignore[assignment]
1417
+ df .columns = (1 , 2 ) # type: ignore[assignment]
1418
+ df .columns = (1 , "a" ) # type: ignore[assignment]
1411
1419
1412
1420
1413
1421
def test_frame_index_numpy () -> None :
You can’t perform that action at this time.
0 commit comments