@@ -193,9 +193,7 @@ def ensure_python_int(value: Union[int, np.integer]) -> int:
193
193
TypeError: if the value isn't an int or can't be converted to one.
194
194
"""
195
195
if not is_scalar (value ):
196
- raise TypeError (
197
- "Value needs to be a scalar value, was type {}" .format (type (value ))
198
- )
196
+ raise TypeError (f"Value needs to be a scalar value, was type { type (value )} " )
199
197
msg = "Wrong type {} for value {}"
200
198
try :
201
199
new_value = int (value )
@@ -1859,7 +1857,7 @@ def _validate_date_like_dtype(dtype) -> None:
1859
1857
try :
1860
1858
typ = np .datetime_data (dtype )[0 ]
1861
1859
except ValueError as e :
1862
- raise TypeError ("{error}" . format ( error = e ) )
1860
+ raise TypeError (e )
1863
1861
if typ != "generic" and typ != "ns" :
1864
1862
raise ValueError (
1865
1863
f"{ repr (dtype .name )} is too specific of a frequency, "
@@ -1900,7 +1898,7 @@ def pandas_dtype(dtype):
1900
1898
npdtype = np .dtype (dtype )
1901
1899
except SyntaxError :
1902
1900
# np.dtype uses `eval` which can raise SyntaxError
1903
- raise TypeError ("data type '{}' not understood" . format ( dtype ) )
1901
+ raise TypeError (f "data type '{ dtype } ' not understood" )
1904
1902
1905
1903
# Any invalid dtype (such as pd.Timestamp) should raise an error.
1906
1904
# np.dtype(invalid_type).kind = 0 for such objects. However, this will
@@ -1912,6 +1910,6 @@ def pandas_dtype(dtype):
1912
1910
# here and `dtype` is an array
1913
1911
return npdtype
1914
1912
elif npdtype .kind == "O" :
1915
- raise TypeError ("dtype '{}' not understood" . format ( dtype ) )
1913
+ raise TypeError (f "dtype '{ dtype } ' not understood" )
1916
1914
1917
1915
return npdtype
0 commit comments