File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1726,7 +1726,11 @@ def icol(self, i):
1726
1726
else :
1727
1727
label = self .columns [i ]
1728
1728
if isinstance (label , Index ):
1729
- return self .reindex (columns = label )
1729
+ if self .columns .inferred_type == 'integer' :
1730
+ # XXX re: #2228
1731
+ return self .reindex (columns = label )
1732
+ else :
1733
+ return self .ix [:, i ]
1730
1734
1731
1735
values = self ._data .iget (i )
1732
1736
return Series .from_array (values , index = self .index , name = label )
Original file line number Diff line number Diff line change @@ -1323,6 +1323,10 @@ def test_irow_icol_duplicates(self):
1323
1323
xp = df .T .ix [0 ]
1324
1324
assert_series_equal (rs , xp )
1325
1325
1326
+ rs = df .icol ([0 ])
1327
+ xp = df .ix [:, [0 ]]
1328
+ assert_frame_equal (rs , xp )
1329
+
1326
1330
def test_iget_value (self ):
1327
1331
for i , row in enumerate (self .frame .index ):
1328
1332
for j , col in enumerate (self .frame .columns ):
You can’t perform that action at this time.
0 commit comments