@@ -88,10 +88,7 @@ def clean_fill_method(method, allow_nearest=False):
88
88
valid_methods .append ("nearest" )
89
89
expecting = "pad (ffill), backfill (bfill) or nearest"
90
90
if method not in valid_methods :
91
- msg = "Invalid fill method. Expecting {expecting}. Got {method}" .format (
92
- expecting = expecting , method = method
93
- )
94
- raise ValueError (msg )
91
+ raise ValueError (f"Invalid fill method. Expecting { expecting } . Got { method } " )
95
92
return method
96
93
97
94
@@ -119,10 +116,7 @@ def clean_interp_method(method, **kwargs):
119
116
if method in ("spline" , "polynomial" ) and order is None :
120
117
raise ValueError ("You must specify the order of the spline or polynomial." )
121
118
if method not in valid :
122
- raise ValueError (
123
- "method must be one of {valid}. Got '{method}' "
124
- "instead." .format (valid = valid , method = method )
125
- )
119
+ raise ValueError (f"method must be one of { valid } . Got '{ method } ' instead." )
126
120
127
121
return method
128
122
@@ -212,7 +206,7 @@ def interpolate_1d(
212
206
limit_direction = limit_direction .lower ()
213
207
if limit_direction not in valid_limit_directions :
214
208
raise ValueError (
215
- f "Invalid limit_direction: expecting one of "
209
+ "Invalid limit_direction: expecting one of "
216
210
f"{ valid_limit_directions } , got '{ limit_direction } '."
217
211
)
218
212
@@ -221,8 +215,8 @@ def interpolate_1d(
221
215
limit_area = limit_area .lower ()
222
216
if limit_area not in valid_limit_areas :
223
217
raise ValueError (
224
- "Invalid limit_area: expecting one of {}, got "
225
- "{ }.". format ( valid_limit_areas , limit_area )
218
+ f "Invalid limit_area: expecting one of { valid_limit_areas } , got "
219
+ f" { limit_area } ."
226
220
)
227
221
228
222
# default limit is unlimited GH #16282
@@ -328,7 +322,7 @@ def _interpolate_scipy_wrapper(
328
322
Returns an array interpolated at new_x. Add any new methods to
329
323
the list in _clean_interp_method.
330
324
"""
331
- extra = "{method} interpolation requires SciPy." . format ( method = method )
325
+ extra = f "{ method } interpolation requires SciPy."
332
326
import_optional_dependency ("scipy" , extra = extra )
333
327
from scipy import interpolate
334
328
@@ -375,8 +369,7 @@ def _interpolate_scipy_wrapper(
375
369
# GH #10633, #24014
376
370
if isna (order ) or (order <= 0 ):
377
371
raise ValueError (
378
- "order needs to be specified and greater than 0; "
379
- "got order: {}" .format (order )
372
+ f"order needs to be specified and greater than 0; got order: { order } "
380
373
)
381
374
terp = interpolate .UnivariateSpline (x , y , k = order , ** kwargs )
382
375
new_y = terp (new_x )
0 commit comments