@@ -193,9 +193,7 @@ def ensure_python_int(value: Union[int, np.integer]) -> int:
193193 TypeError: if the value isn't an int or can't be converted to one.
194194 """
195195 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 )} " )
199197 msg = "Wrong type {} for value {}"
200198 try :
201199 new_value = int (value )
@@ -1859,7 +1857,7 @@ def _validate_date_like_dtype(dtype) -> None:
18591857 try :
18601858 typ = np .datetime_data (dtype )[0 ]
18611859 except ValueError as e :
1862- raise TypeError ("{error}" . format ( error = e ) )
1860+ raise TypeError (e )
18631861 if typ != "generic" and typ != "ns" :
18641862 raise ValueError (
18651863 f"{ repr (dtype .name )} is too specific of a frequency, "
@@ -1900,7 +1898,7 @@ def pandas_dtype(dtype):
19001898 npdtype = np .dtype (dtype )
19011899 except SyntaxError :
19021900 # 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" )
19041902
19051903 # Any invalid dtype (such as pd.Timestamp) should raise an error.
19061904 # np.dtype(invalid_type).kind = 0 for such objects. However, this will
@@ -1912,6 +1910,6 @@ def pandas_dtype(dtype):
19121910 # here and `dtype` is an array
19131911 return npdtype
19141912 elif npdtype .kind == "O" :
1915- raise TypeError ("dtype '{}' not understood" . format ( dtype ) )
1913+ raise TypeError (f "dtype '{ dtype } ' not understood" )
19161914
19171915 return npdtype
0 commit comments