Skip to content

Commit ba7c6be

Browse files
author
MomIsBestFriend
committed
Finished index.pyx
1 parent e64e327 commit ba7c6be

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pandas/_libs/index.pyx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ cdef class IndexEngine:
109109
Py_ssize_t loc
110110

111111
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")
113113

114114
if self.over_size_threshold and self.is_monotonic_increasing:
115115
if not self.is_unique:
@@ -556,8 +556,8 @@ cpdef convert_scalar(ndarray arr, object value):
556556
pass
557557
elif value is None or value != value:
558558
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__}")
561561

562562
elif arr.descr.type_num == NPY_TIMEDELTA:
563563
if util.is_array(value):
@@ -573,8 +573,8 @@ cpdef convert_scalar(ndarray arr, object value):
573573
pass
574574
elif value is None or value != value:
575575
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__}")
578578

579579
if (issubclass(arr.dtype.type, (np.integer, np.floating, np.complex)) and
580580
not issubclass(arr.dtype.type, np.bool_)):
@@ -677,7 +677,7 @@ cdef class BaseMultiIndexCodesEngine:
677677
# Index._get_fill_indexer), sort (integer representations of) keys:
678678
order = np.argsort(lab_ints)
679679
lab_ints = lab_ints[order]
680-
indexer = (getattr(self._base, 'get_{}_indexer'.format(method))
680+
indexer = (getattr(self._base, f'get_{method}_indexer')
681681
(self, lab_ints, limit=limit))
682682
indexer = indexer[order]
683683
else:
@@ -687,7 +687,7 @@ cdef class BaseMultiIndexCodesEngine:
687687

688688
def get_loc(self, object key):
689689
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")
691691
if not isinstance(key, tuple):
692692
raise KeyError(key)
693693
try:

0 commit comments

Comments
 (0)