fix: move do_predict and DI_values into dict before DataFrame construction

Address review feedback: do_predict and DI_values were still assigned
after DataFrame creation, partially defeating the fragmentation fix.
Now all columns are collected in the dict before the single DataFrame()
call, ensuring zero post-construction column assignments.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Briarion
2026-03-18 08:05:22 +03:00
parent a8c887a5b0
commit 9560ba2144
+4 -4
View File
@@ -445,11 +445,11 @@ class FreqaiDataKitchen:
for extra_col in self.data["extra_returns_per_train"]:
append_dict[f"{extra_col}"] = self.data["extra_returns_per_train"][extra_col]
append_df = DataFrame(append_dict)
append_df["do_predict"] = do_predict
append_dict["do_predict"] = do_predict
if self.freqai_config["feature_parameters"].get("DI_threshold", 0) > 0:
append_df["DI_values"] = self.DI_values
append_dict["DI_values"] = self.DI_values
append_df = DataFrame(append_dict)
user_cols = [col for col in dataframe_backtest.columns if col.startswith("%%")]
cols = ["date"]