diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py index 9cd9fce98ff35b62151f89e1debbbb23c0bcc172..add425871f529cba066f5b521422ab56938c8713 100644 --- a/mlair/run_modules/post_processing.py +++ b/mlair/run_modules/post_processing.py @@ -1014,6 +1014,7 @@ class PostProcessing(RunEnvironment): report_path = os.path.join(self.data_store.get("experiment_path"), "latex_report") path_config.check_path_and_create(report_path) res = [] + max_cols = 0 for boot_type, d0 in results.items(): for boot_method, d1 in d0.items(): for station_name, vals in d1.items(): @@ -1022,8 +1023,9 @@ class PostProcessing(RunEnvironment): res.append([boot_type, boot_method, station_name, boot_var, ahead, *vals.sel({self.boot_var_dim: boot_var, self.ahead_dim: ahead}).values.round(5).tolist()]) + max_cols = max(max_cols, len(res[-1])) col_names = [self.model_type_dim, "method", "station", self.boot_var_dim, self.ahead_dim, - *list(range(len(res[0]) - 5))] + *list(range(max_cols - 5))] df = pd.DataFrame(res, columns=col_names) file_name = "feature_importance_skill_score_report_raw.csv" df.to_csv(os.path.join(report_path, file_name), sep=";")