File tree 2 files changed +9
-0
lines changed
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1809,6 +1809,11 @@ def _slice(self, slicer):
1809
1809
if not com .is_null_slice (slicer [0 ]):
1810
1810
raise AssertionError ("invalid slicing for a 1-ndim categorical" )
1811
1811
slicer = slicer [1 ]
1812
+ elif not isinstance (slicer , tuple ) and self .ndim == 2 :
1813
+ # reached via getitem_block via _slice_take_blocks_ax0
1814
+ # TODO(EA2D): wont be necessary with 2D EAs
1815
+ # treat this like (slicer, slice(None)
1816
+ slicer = slice (None )
1812
1817
1813
1818
return self .values [slicer ]
1814
1819
Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ def test_iloc_frame(self, data):
40
40
result = df .iloc [:4 , 0 ]
41
41
self .assert_series_equal (result , expected )
42
42
43
+ # GH#32957 null slice along index, slice along rows
44
+ result = df .iloc [:, :1 ]
45
+ self .assert_frame_equal (result , df [["A" ]])
46
+
43
47
def test_loc_series (self , data ):
44
48
ser = pd .Series (data )
45
49
result = ser .loc [:3 ]
You can’t perform that action at this time.
0 commit comments