Skip to content

Commit f031ccf

Browse files
Add Tuple[slice] in iLocIndexerFrame. Fix #143 (#152)
* Add Tuple[slice] in iLocIndexerFrame. Fix #143 * Add test for iloc[Tuple[slice]] * Add comment & spacing * Fix style according to black standard
1 parent dd93d48 commit f031ccf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pandas-stubs/core/frame.pyi

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ class _iLocIndexerFrame(_iLocIndexer):
8989
@overload
9090
def __getitem__(
9191
self,
92-
idx: IndexType | MaskType | tuple[IndexType | MaskType, IndexType | MaskType],
92+
idx: IndexType
93+
| MaskType
94+
| tuple[IndexType | MaskType, IndexType | MaskType]
95+
| tuple[slice],
9396
) -> DataFrame: ...
9497
def __setitem__(
9598
self,

tests/test_frame.py

+8
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,14 @@ def test_iloc_npint() -> None:
11811181
df.iloc[iloc]
11821182

11831183

1184+
# https://github.com/pandas-dev/pandas-stubs/issues/143
1185+
def test_iloc_tuple() -> None:
1186+
df = pd.DataFrame({"Char": ["A", "B", "C"], "Number": [1, 2, 3]})
1187+
df = df.iloc[
1188+
0:2,
1189+
]
1190+
1191+
11841192
def test_set_columns() -> None:
11851193
# GH 73
11861194
df = pd.DataFrame({"a": [1, 2, 3], "b": [0.0, 1, 1]})

0 commit comments

Comments
 (0)