File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -777,6 +777,8 @@ class _iLocIndexer(_LocationIndexer):
777777 def _has_valid_type (self , key , axis ):
778778 if com ._is_bool_indexer (key ):
779779 if hasattr (key ,'index' ) and isinstance (key .index ,Index ):
780+ if key .index .inferred_type == 'integer' :
781+ raise NotImplementedError ("iLocation based boolean indexing on an integer type is not available" )
780782 raise ValueError ("iLocation based boolean indexing cannot use an indexable as a mask" )
781783 return True
782784
Original file line number Diff line number Diff line change @@ -895,7 +895,7 @@ def test_iloc_mask(self):
895895 mask = (df .a % 2 == 0 )
896896 self .assertRaises (ValueError , df .iloc .__getitem__ , tuple ([mask ]))
897897 mask .index = range (len (mask ))
898- self .assertRaises (ValueError , df .iloc .__getitem__ , tuple ([mask ]))
898+ self .assertRaises (NotImplementedError , df .iloc .__getitem__ , tuple ([mask ]))
899899
900900 # ndarray ok
901901 result = df .iloc [np .array ([True ] * len (mask ),dtype = bool )]
@@ -916,7 +916,7 @@ def test_iloc_mask(self):
916916 ('index' ,'.iloc' ) : 'iLocation based boolean indexing cannot use an indexable as a mask' ,
917917 ('locs' ,'' ) : 'Unalignable boolean Series key provided' ,
918918 ('locs' ,'.loc' ) : 'Unalignable boolean Series key provided' ,
919- ('locs' ,'.iloc' ) : 'iLocation based boolean indexing cannot use an indexable as a mask ' ,
919+ ('locs' ,'.iloc' ) : 'iLocation based boolean indexing on an integer type is not available ' ,
920920 }
921921
922922 import warnings
You can’t perform that action at this time.
0 commit comments