@@ -862,9 +862,10 @@ def to_int():
862
862
return self ._invalid_indexer ('label' , key )
863
863
864
864
if is_float (key ):
865
- if not self .is_floating ():
866
- warnings .warn ("scalar indexers for index type {0} should be integers and not floating point" .format (
867
- type (self ).__name__ ), FutureWarning , stacklevel = 3 )
865
+ if isnull (key ):
866
+ return self ._invalid_indexer ('label' , key )
867
+ warnings .warn ("scalar indexers for index type {0} should be integers and not floating point" .format (
868
+ type (self ).__name__ ), FutureWarning , stacklevel = 3 )
868
869
return to_int ()
869
870
870
871
return key
@@ -3721,9 +3722,23 @@ def astype(self, dtype):
3721
3722
return Index (self ._values , name = self .name , dtype = dtype )
3722
3723
3723
3724
def _convert_scalar_indexer (self , key , kind = None ):
3725
+ """
3726
+ convert a scalar indexer
3727
+
3728
+ Parameters
3729
+ ----------
3730
+ key : label of the slice bound
3731
+ kind : optional, type of the indexing operation (loc/ix/iloc/None)
3732
+
3733
+ right now we are converting
3734
+ floats -> ints if the index supports it
3735
+ """
3736
+
3724
3737
if kind == 'iloc' :
3725
- return super (Float64Index , self )._convert_scalar_indexer (key ,
3726
- kind = kind )
3738
+ if is_integer (key ):
3739
+ return key
3740
+ return super (Float64Index , self )._convert_scalar_indexer (key , kind = kind )
3741
+
3727
3742
return key
3728
3743
3729
3744
def _convert_slice_indexer (self , key , kind = None ):
0 commit comments