@@ -3175,6 +3175,26 @@ def test_set_ix_out_of_bounds_axis_1(self):
31753175 df = pd .DataFrame (randn (5 , 2 ), index = ["row%s" % i for i in range (5 )], columns = ["col%s" % i for i in range (2 )])
31763176 self .assertRaises (ValueError , df .ix .__setitem__ , (0 , 2 ), 100 )
31773177
3178+ def test_iloc_empty_list_indexer_is_ok (self ):
3179+ from pandas .util .testing import makeCustomDataframe as mkdf
3180+ df = mkdf (5 , 2 )
3181+ assert_frame_equal (df .iloc [:,[]], df .iloc [:, :0 ]) # vertical empty
3182+ assert_frame_equal (df .iloc [[],:], df .iloc [:0 , :]) # horizontal empty
3183+
3184+ # FIXME: fix loc & xs
3185+ def test_loc_empty_list_indexer_is_ok (self ):
3186+ raise nose .SkipTest ('loc discards columns names' )
3187+ from pandas .util .testing import makeCustomDataframe as mkdf
3188+ df = mkdf (5 , 2 )
3189+ assert_frame_equal (df .loc [:,[]], df .iloc [:, :0 ]) # vertical empty
3190+ assert_frame_equal (df .loc [[],:], df .iloc [:0 , :]) # horizontal empty
3191+
3192+ def test_ix_empty_list_indexer_is_ok (self ):
3193+ raise nose .SkipTest ('ix discards columns names' )
3194+ from pandas .util .testing import makeCustomDataframe as mkdf
3195+ df = mkdf (5 , 2 )
3196+ assert_frame_equal (df .ix [:,[]], df .iloc [:, :0 ]) # vertical empty
3197+ assert_frame_equal (df .ix [[],:], df .iloc [:0 , :]) # horizontal empty
31783198
31793199if __name__ == '__main__' :
31803200 import nose
0 commit comments