From 70d01cb27754b298f5165376fb05dd88e3954e2b Mon Sep 17 00:00:00 2001 From: itlubber <1830611168@qq.com> Date: Thu, 29 Feb 2024 18:14:15 +0800 Subject: [PATCH] fix rule extractor report --- scorecardpipeline/rule_extraction.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scorecardpipeline/rule_extraction.py b/scorecardpipeline/rule_extraction.py index 1a68b50..1c4710d 100644 --- a/scorecardpipeline/rule_extraction.py +++ b/scorecardpipeline/rule_extraction.py @@ -325,14 +325,14 @@ def report(self, valid=None, sheet="组合策略汇总", save=None): if self.feature_map is not None and len(self.feature_map) > 0: parsed_rules_train["组合策略"] = parsed_rules_train["组合策略"].replace(self.feature_map, regex=True) - self.end_row, _ = self.writer.insert_value2sheet(worksheet, (2 if sheet else self.end_row + 2, self.start_col), value="组合策略: 训练集", style="header_middle", end_space=(2 if sheet else self.end_row + 2, self.start_col + len(parsed_rules_train.columns))) + self.end_row, _ = self.writer.insert_value2sheet(worksheet, (2 if sheet else self.end_row + 2, self.start_col), value="组合策略: 训练集", style="header_middle", end_space=(2 if sheet else self.end_row + 2, self.start_col + len(parsed_rules_train.columns) - 1)) self.end_row, _ = self.insert_dt_rules(parsed_rules_train, self.end_row, self.start_col, sheet=worksheet) outputs = (parsed_rules_train,) if valid is not None: if isinstance(valid, pd.DataFrame) and len(valid) > 0: parsed_rules_val = self.transform(valid) - self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value="组合策略: 验证集", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns))) + self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value="组合策略: 验证集", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns) - 1)) self.end_row, _ = self.insert_dt_rules(parsed_rules_val, self.end_row, self.start_col, sheet=worksheet) outputs = outputs + (parsed_rules_val,) @@ -340,7 +340,7 @@ def report(self, valid=None, sheet="组合策略汇总", save=None): for i, dataset in enumerate(valid): if isinstance(dataset, pd.DataFrame) and len(dataset) > 0: parsed_rules_val = self.transform(dataset) - self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value=f"组合策略: 验证集 {i + 1}", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns))) + self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value=f"组合策略: 验证集 {i + 1}", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns) - 1)) self.end_row, _ = self.insert_dt_rules(parsed_rules_val, self.end_row, self.start_col, sheet=worksheet) outputs = outputs + (parsed_rules_val,) @@ -348,7 +348,7 @@ def report(self, valid=None, sheet="组合策略汇总", save=None): for k, dataset in valid.items(): if isinstance(dataset, pd.DataFrame) and len(dataset) > 0: parsed_rules_val = self.transform(dataset) - self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value=f"组合策略: {k}", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns))) + self.end_row, _ = self.writer.insert_value2sheet(worksheet, (self.end_row + 2, self.start_col), value=f"组合策略: {k}", style="header_middle", end_space=(self.end_row + 2, self.start_col + len(parsed_rules_val.columns) - 1)) self.end_row, _ = self.insert_dt_rules(parsed_rules_val, self.end_row, self.start_col, sheet=worksheet) outputs = outputs + (parsed_rules_val,)