Skip to content

Commit 45a8a68

Browse files
JvPyjreback
authored andcommitted
STY - fstrings on frame.py & numeric.py (#30197)
1 parent f6d94a5 commit 45a8a68

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7792,7 +7792,7 @@ def _get_agg_axis(self, axis_num):
77927792
elif axis_num == 1:
77937793
return self.index
77947794
else:
7795-
raise ValueError("Axis must be 0 or 1 (got %r)" % axis_num)
7795+
raise ValueError(f"Axis must be 0 or 1 (got {repr(axis_num)})")
77967796

77977797
def mode(self, axis=0, numeric_only=False, dropna=True):
77987798
"""

pandas/core/indexes/numeric.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,16 @@ def _convert_tolerance(self, tolerance, target):
122122
if tolerance.ndim > 0:
123123
raise ValueError(
124124
(
125-
"tolerance argument for %s must contain "
125+
f"tolerance argument for {type(self).__name__} must contain "
126126
"numeric elements if it is list type"
127127
)
128-
% (type(self).__name__,)
129128
)
130129
else:
131130
raise ValueError(
132131
(
133-
"tolerance argument for %s must be numeric "
134-
"if it is a scalar: %r"
132+
f"tolerance argument for {type(self).__name__} must be numeric "
133+
f"if it is a scalar: {repr(tolerance)}"
135134
)
136-
% (type(self).__name__, tolerance)
137135
)
138136
return tolerance
139137

0 commit comments

Comments
 (0)