@@ -104,9 +104,9 @@ def _coerce_method(converter):
104
104
def wrapper (self ):
105
105
if len (self ) == 1 :
106
106
return converter (self .iloc [0 ])
107
- raise TypeError ("cannot convert the series to {0}" . format ( str ( converter )) )
107
+ raise TypeError (f "cannot convert the series to { converter } " )
108
108
109
- wrapper .__name__ = "__{name}__" . format ( name = converter .__name__ )
109
+ wrapper .__name__ = f "__{ converter .__name__ } __"
110
110
return wrapper
111
111
112
112
@@ -274,8 +274,8 @@ def __init__(
274
274
try :
275
275
if len (index ) != len (data ):
276
276
raise ValueError (
277
- "Length of passed values is {val }, "
278
- "index implies {ind}" . format ( val = len (data ), ind = len ( index ))
277
+ f "Length of passed values is { len ( data ) } , "
278
+ f "index implies { len (index )} ."
279
279
)
280
280
except TypeError :
281
281
pass
@@ -1453,7 +1453,7 @@ def items(self):
1453
1453
--------
1454
1454
>>> s = pd.Series(['A', 'B', 'C'])
1455
1455
>>> for index, value in s.items():
1456
- ... print("Index : {}, Value : {}".format(index, value) )
1456
+ ... print(f "Index : {index }, Value : {value}" )
1457
1457
Index : 0, Value : A
1458
1458
Index : 1, Value : B
1459
1459
Index : 2, Value : C
@@ -2160,7 +2160,7 @@ def corr(self, other, method="pearson", min_periods=None):
2160
2160
raise ValueError (
2161
2161
"method must be either 'pearson', "
2162
2162
"'spearman', 'kendall', or a callable, "
2163
- "'{method}' was supplied" . format ( method = method )
2163
+ f "'{ method } ' was supplied"
2164
2164
)
2165
2165
2166
2166
def cov (self , other , min_periods = None ):
@@ -2876,7 +2876,7 @@ def _try_kind_sort(arr):
2876
2876
sortedIdx [n :] = idx [good ][argsorted ]
2877
2877
sortedIdx [:n ] = idx [bad ]
2878
2878
else :
2879
- raise ValueError (f"invalid na_position: { repr ( na_position ) } " )
2879
+ raise ValueError (f"invalid na_position: { na_position } " )
2880
2880
2881
2881
result = self ._constructor (arr [sortedIdx ], index = self .index [sortedIdx ])
2882
2882
@@ -3768,7 +3768,7 @@ def _reduce(
3768
3768
elif isinstance (delegate , np .ndarray ):
3769
3769
if numeric_only :
3770
3770
raise NotImplementedError (
3771
- "Series.{0 } does not implement numeric_only." . format ( name )
3771
+ f "Series.{ name } does not implement numeric_only."
3772
3772
)
3773
3773
with np .errstate (all = "ignore" ):
3774
3774
return op (delegate , skipna = skipna , ** kwds )
0 commit comments