@@ -871,15 +871,12 @@ def get_dummies(
871
871
# validate prefixes and separator to avoid silently dropping cols
872
872
def check_len (item , name ):
873
873
len_msg = (
874
- "Length of '{name}' ({len_item }) did not match the "
875
- "length of the columns being encoded ({len_enc })."
874
+ f "Length of '{ name } ' ({ len ( item ) } ) did not match the "
875
+ f "length of the columns being encoded ({ data_to_encode . shape [ 1 ] } )."
876
876
)
877
877
878
878
if is_list_like (item ):
879
879
if not len (item ) == data_to_encode .shape [1 ]:
880
- len_msg = len_msg .format (
881
- name = name , len_item = len (item ), len_enc = data_to_encode .shape [1 ]
882
- )
883
880
raise ValueError (len_msg )
884
881
885
882
check_len (prefix , "prefix" )
@@ -986,8 +983,8 @@ def get_empty_frame(data) -> DataFrame:
986
983
987
984
# PY2 embedded unicode, gh-22084
988
985
def _make_col_name (prefix , prefix_sep , level ) -> str :
989
- fstr = "{prefix}{prefix_sep}{level}"
990
- return fstr . format ( prefix = prefix , prefix_sep = prefix_sep , level = level )
986
+ fstr = f "{ prefix } { prefix_sep } { level } "
987
+ return fstr
991
988
992
989
dummy_cols = [_make_col_name (prefix , prefix_sep , level ) for level in levels ]
993
990
0 commit comments