@@ -109,7 +109,7 @@ cdef class IndexEngine:
109
109
Py_ssize_t loc
110
110
111
111
if is_definitely_invalid_key(val):
112
- raise TypeError (" '{val}' is an invalid key" .format( val = val) )
112
+ raise TypeError (f " '{val}' is an invalid key" )
113
113
114
114
if self .over_size_threshold and self .is_monotonic_increasing:
115
115
if not self .is_unique:
@@ -556,8 +556,8 @@ cpdef convert_scalar(ndarray arr, object value):
556
556
pass
557
557
elif value is None or value != value:
558
558
return np.datetime64(" NaT" , " ns" )
559
- raise ValueError (" cannot set a Timestamp with a non-timestamp {typ} "
560
- .format( typ = type (value).__name__) )
559
+ raise ValueError (f " cannot set a Timestamp with a non-timestamp "
560
+ f " { type(value).__name__} " )
561
561
562
562
elif arr.descr.type_num == NPY_TIMEDELTA:
563
563
if util.is_array(value):
@@ -573,8 +573,8 @@ cpdef convert_scalar(ndarray arr, object value):
573
573
pass
574
574
elif value is None or value != value:
575
575
return np.timedelta64(" NaT" , " ns" )
576
- raise ValueError (" cannot set a Timedelta with a non-timedelta {typ} "
577
- .format( typ = type (value).__name__) )
576
+ raise ValueError (f " cannot set a Timedelta with a non-timedelta "
577
+ f " { type(value).__name__} " )
578
578
579
579
if (issubclass (arr.dtype.type, (np.integer, np.floating, np.complex)) and
580
580
not issubclass (arr.dtype.type, np.bool_)):
@@ -677,7 +677,7 @@ cdef class BaseMultiIndexCodesEngine:
677
677
# Index._get_fill_indexer), sort (integer representations of) keys:
678
678
order = np.argsort(lab_ints)
679
679
lab_ints = lab_ints[order]
680
- indexer = (getattr (self ._base, ' get_{}_indexer' .format(method) )
680
+ indexer = (getattr (self ._base, f ' get_{method }_indexer' )
681
681
(self , lab_ints, limit= limit))
682
682
indexer = indexer[order]
683
683
else :
@@ -687,7 +687,7 @@ cdef class BaseMultiIndexCodesEngine:
687
687
688
688
def get_loc (self , object key ):
689
689
if is_definitely_invalid_key(key):
690
- raise TypeError (" '{key}' is an invalid key" .format( key = key) )
690
+ raise TypeError (f " '{key}' is an invalid key" )
691
691
if not isinstance (key, tuple ):
692
692
raise KeyError (key)
693
693
try :
0 commit comments