Skip to content

Commit 931e6d1

Browse files
committed
Remove complicated f-string for H2O column_types; replace with string definition.
1 parent ba0a687 commit 931e6d1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/sasctl/pzmm/write_score_code.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,15 @@ def _predict_method(
632632
column_names = ", ".join(f'"{col}"' for col in var_list)
633633
# H2O models
634634
if dtype_list:
635-
column_types = []
635+
column_types = "{"
636636
for var, dtype in zip(var_list, dtype_list):
637637
if any(x in dtype for x in ["int", "float"]):
638638
col_type = "numeric"
639639
else:
640640
col_type = "string"
641-
column_types.append(f'"{var}" : "{col_type}"')
641+
column_types += f'"{var}" : "{col_type}", '
642+
column_types = column_types.rstrip(", ")
643+
column_types += "}"
642644
cls.score_code += (
643645
f"{'':4}input_array = pd.DataFrame("
644646
f"[[{', '.join(var_list)}]],\n{'':31}columns=["

0 commit comments

Comments
 (0)