feat: add a check for whether values in score_df are NaN (#756)

* add a check for whether values in score_df are NaN

* fix ci

* change raise to assert
This commit is contained in:
Yuante Li
2025-04-04 22:44:55 +08:00
committed by GitHub
parent 9415113e01
commit 11e8acc88b
3 changed files with 17 additions and 0 deletions
@@ -106,6 +106,12 @@ class WorkflowGeneralCaseSpecEvaluator(CoSTEEREvaluator):
score_check_text += f"\n[Error] The scores dataframe does not contain the correct column names.\nCorrect columns is: ['{self.scen.metric_name}']\nBut got: {score_df.columns.tolist()}"
score_ret_code = 1
# Check if scores contain NaN (values)
if score_df.isnull().values.any():
nan_locations = score_df[score_df.isnull().any(axis=1)]
score_check_text += f"\n[Error] The scores dataframe contains NaN values at the following locations:\n{nan_locations}"
score_ret_code = 1
except Exception as e:
score_check_text += f"\n[Error] in checking the scores.csv file: {e}\nscores.csv's content:\n-----\n{score_fp.read_text()}\n-----"
score_ret_code = 1