@@ -600,13 +600,11 @@ def __init__(
600
600
601
601
if not is_bool (left_index ):
602
602
raise ValueError (
603
- "left_index parameter must be of type bool, not "
604
- "{left_index}" .format (left_index = type (left_index ))
603
+ f"left_index parameter must be of type bool, not { type (left_index )} "
605
604
)
606
605
if not is_bool (right_index ):
607
606
raise ValueError (
608
- "right_index parameter must be of type bool, not "
609
- "{right_index}" .format (right_index = type (right_index ))
607
+ f"right_index parameter must be of type bool, not { type (right_index )} "
610
608
)
611
609
612
610
# warn user when merging between different levels
@@ -1092,8 +1090,7 @@ def _maybe_coerce_merge_keys(self):
1092
1090
warnings .warn (
1093
1091
"You are merging on int and float "
1094
1092
"columns where the float values "
1095
- "are not equal to their int "
1096
- "representation" ,
1093
+ "are not equal to their int representation" ,
1097
1094
UserWarning ,
1098
1095
)
1099
1096
continue
@@ -1103,8 +1100,7 @@ def _maybe_coerce_merge_keys(self):
1103
1100
warnings .warn (
1104
1101
"You are merging on int and float "
1105
1102
"columns where the float values "
1106
- "are not equal to their int "
1107
- "representation" ,
1103
+ "are not equal to their int representation" ,
1108
1104
UserWarning ,
1109
1105
)
1110
1106
continue
@@ -1251,20 +1247,17 @@ def _validate(self, validate: str):
1251
1247
)
1252
1248
elif not left_unique :
1253
1249
raise MergeError (
1254
- "Merge keys are not unique in left dataset; "
1255
- "not a one-to-one merge"
1250
+ "Merge keys are not unique in left dataset; not a one-to-one merge"
1256
1251
)
1257
1252
elif not right_unique :
1258
1253
raise MergeError (
1259
- "Merge keys are not unique in right dataset; "
1260
- "not a one-to-one merge"
1254
+ "Merge keys are not unique in right dataset; not a one-to-one merge"
1261
1255
)
1262
1256
1263
1257
elif validate in ["one_to_many" , "1:m" ]:
1264
1258
if not left_unique :
1265
1259
raise MergeError (
1266
- "Merge keys are not unique in left dataset; "
1267
- "not a one-to-many merge"
1260
+ "Merge keys are not unique in left dataset; not a one-to-many merge"
1268
1261
)
1269
1262
1270
1263
elif validate in ["many_to_one" , "m:1" ]:
@@ -1833,8 +1826,7 @@ def _left_join_on_index(left_ax: Index, right_ax: Index, join_keys, sort: bool =
1833
1826
raise AssertionError (
1834
1827
"If more than one join key is given then "
1835
1828
"'right_ax' must be a MultiIndex and the "
1836
- "number of join keys must be the number of "
1837
- "levels in right_ax"
1829
+ "number of join keys must be the number of levels in right_ax"
1838
1830
)
1839
1831
1840
1832
left_indexer , right_indexer = _get_multiindex_indexer (
@@ -2004,8 +1996,7 @@ def _validate_operand(obj: FrameOrSeries) -> "DataFrame":
2004
1996
return obj .to_frame ()
2005
1997
else :
2006
1998
raise TypeError (
2007
- "Can only merge Series or DataFrame objects, "
2008
- "a {obj} was passed" .format (obj = type (obj ))
1999
+ f"Can only merge Series or DataFrame objects, a { type (obj )} was passed"
2009
2000
)
2010
2001
2011
2002
@@ -2021,10 +2012,7 @@ def _items_overlap_with_suffix(left: Index, lsuffix, right: Index, rsuffix):
2021
2012
return left , right
2022
2013
2023
2014
if not lsuffix and not rsuffix :
2024
- raise ValueError (
2025
- "columns overlap but no suffix specified: "
2026
- "{rename}" .format (rename = to_rename )
2027
- )
2015
+ raise ValueError (f"columns overlap but no suffix specified: { to_rename } " )
2028
2016
2029
2017
def renamer (x , suffix ):
2030
2018
"""
@@ -2043,7 +2031,7 @@ def renamer(x, suffix):
2043
2031
x : renamed column name
2044
2032
"""
2045
2033
if x in to_rename and suffix is not None :
2046
- return "{x}{suffix}" . format ( x = x , suffix = suffix )
2034
+ return f "{ x } { suffix } "
2047
2035
return x
2048
2036
2049
2037
lrenamer = partial (renamer , suffix = lsuffix )
0 commit comments