Skip to content

Commit ce29248

Browse files
CLN: GH29547 format with f-strings (#34399)
1 parent 3aca14d commit ce29248

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pandas/util/_validators.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ def validate_axis_style_args(data, args, kwargs, arg_name, method_name):
295295
raise TypeError(msg)
296296

297297
msg = (
298-
"Interpreting call\n\t'.{method_name}(a, b)' as "
299-
"\n\t'.{method_name}(index=a, columns=b)'.\nUse named "
298+
f"Interpreting call\n\t'.{method_name}(a, b)' as "
299+
f"\n\t'.{method_name}(index=a, columns=b)'.\nUse named "
300300
"arguments to remove any ambiguity. In the future, using "
301301
"positional arguments for 'index' or 'columns' will raise "
302302
"a 'TypeError'."
303303
)
304-
warnings.warn(msg.format(method_name=method_name), FutureWarning, stacklevel=4)
304+
warnings.warn(msg, FutureWarning, stacklevel=4)
305305
out[data._get_axis_name(0)] = args[0]
306306
out[data._get_axis_name(1)] = args[1]
307307
else:
@@ -370,12 +370,15 @@ def validate_percentile(q: Union[float, Iterable[float]]) -> np.ndarray:
370370
------
371371
ValueError if percentiles are not in given interval([0, 1]).
372372
"""
373-
msg = "percentiles should all be in the interval [0, 1]. Try {0} instead."
374373
q_arr = np.asarray(q)
374+
msg = (
375+
"percentiles should all be in the interval [0, 1]."
376+
f"Try {q_arr / 100.0} instead."
377+
)
375378
if q_arr.ndim == 0:
376379
if not 0 <= q_arr <= 1:
377-
raise ValueError(msg.format(q_arr / 100.0))
380+
raise ValueError(msg)
378381
else:
379382
if not all(0 <= qs <= 1 for qs in q_arr):
380-
raise ValueError(msg.format(q_arr / 100.0))
383+
raise ValueError(msg)
381384
return q_arr

0 commit comments

Comments
 (0)