File tree 2 files changed +4
-2
lines changed 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -777,6 +777,8 @@ class _iLocIndexer(_LocationIndexer):
777
777
def _has_valid_type (self , key , axis ):
778
778
if com ._is_bool_indexer (key ):
779
779
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" )
780
782
raise ValueError ("iLocation based boolean indexing cannot use an indexable as a mask" )
781
783
return True
782
784
Original file line number Diff line number Diff line change @@ -895,7 +895,7 @@ def test_iloc_mask(self):
895
895
mask = (df .a % 2 == 0 )
896
896
self .assertRaises (ValueError , df .iloc .__getitem__ , tuple ([mask ]))
897
897
mask .index = range (len (mask ))
898
- self .assertRaises (ValueError , df .iloc .__getitem__ , tuple ([mask ]))
898
+ self .assertRaises (NotImplementedError , df .iloc .__getitem__ , tuple ([mask ]))
899
899
900
900
# ndarray ok
901
901
result = df .iloc [np .array ([True ] * len (mask ),dtype = bool )]
@@ -916,7 +916,7 @@ def test_iloc_mask(self):
916
916
('index' ,'.iloc' ) : 'iLocation based boolean indexing cannot use an indexable as a mask' ,
917
917
('locs' ,'' ) : 'Unalignable boolean Series key provided' ,
918
918
('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 ' ,
920
920
}
921
921
922
922
import warnings
You can’t perform that action at this time.
0 commit comments