Skip to content

Commit dd3e437

Browse files
author
MomIsBestFriend
committed
Finished lib.pyx
1 parent 89bdecc commit dd3e437

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

pandas/_libs/lib.pyx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,8 +1219,7 @@ def infer_dtype(value: object, skipna: object=None) -> str:
12191219
return value
12201220

12211221
# its ndarray like but we can't handle
1222-
raise ValueError("cannot infer type for {typ}"
1223-
.format(typ=type(value)))
1222+
raise ValueError(f"cannot infer type for {type(value)}")
12241223

12251224
else:
12261225
if not isinstance(value, list):
@@ -1497,9 +1496,8 @@ cdef class Validator:
14971496
return self.is_valid(value) or self.is_valid_null(value)
14981497

14991498
cdef bint is_value_typed(self, object value) except -1:
1500-
raise NotImplementedError(
1501-
'{typ} child class must define is_value_typed'
1502-
.format(typ=type(self).__name__))
1499+
raise NotImplementedError(f'{type(self).__name__} child class '
1500+
f'must define is_value_typed')
15031501

15041502
cdef bint is_valid_null(self, object value) except -1:
15051503
return value is None or util.is_nan(value)
@@ -1635,9 +1633,8 @@ cdef class TemporalValidator(Validator):
16351633
return self.is_value_typed(value) or self.is_valid_null(value)
16361634

16371635
cdef bint is_valid_null(self, object value) except -1:
1638-
raise NotImplementedError(
1639-
'{typ} child class must define is_valid_null'
1640-
.format(typ=type(self).__name__))
1636+
raise NotImplementedError(f'{type(self).__name__} child class '
1637+
f'must define is_valid_null')
16411638

16421639
cdef inline bint is_valid_skipna(self, object value) except -1:
16431640
cdef:
@@ -1926,7 +1923,7 @@ def maybe_convert_numeric(ndarray[object] values, set na_values,
19261923
seen.float_ = True
19271924
except (TypeError, ValueError) as e:
19281925
if not seen.coerce_numeric:
1929-
raise type(e)(str(e) + " at position {pos}".format(pos=i))
1926+
raise type(e)(str(e) + f" at position {i}")
19301927
elif "uint64" in str(e): # Exception from check functions.
19311928
raise
19321929

0 commit comments

Comments
 (0)