@@ -193,7 +193,7 @@ def _add_margins(
193
193
if not isinstance (margins_name , str ):
194
194
raise ValueError ("margins_name argument must be a string" )
195
195
196
- msg = 'Conflicting name "{name }" in margins' . format ( name = margins_name )
196
+ msg = f 'Conflicting name "{ margins_name } " in margins'
197
197
for level in table .index .names :
198
198
if margins_name in table .index .get_level_values (level ):
199
199
raise ValueError (msg )
@@ -620,9 +620,7 @@ def _normalize(table, normalize, margins, margins_name="All"):
620
620
if (margins_name not in table .iloc [- 1 , :].name ) | (
621
621
margins_name != table .iloc [:, - 1 ].name
622
622
):
623
- raise ValueError (
624
- "{mname} not in pivoted DataFrame" .format (mname = margins_name )
625
- )
623
+ raise ValueError (f"{ margins_name } not in pivoted DataFrame" )
626
624
column_margin = table .iloc [:- 1 , - 1 ]
627
625
index_margin = table .iloc [- 1 , :- 1 ]
628
626
@@ -672,7 +670,7 @@ def _get_names(arrs, names, prefix="row"):
672
670
if isinstance (arr , ABCSeries ) and arr .name is not None :
673
671
names .append (arr .name )
674
672
else :
675
- names .append ("{prefix}_{i}" . format ( prefix = prefix , i = i ) )
673
+ names .append (f "{ prefix } _{ i } " )
676
674
else :
677
675
if len (names ) != len (arrs ):
678
676
raise AssertionError ("arrays and names must have the same length" )
0 commit comments