Madhavan Iyengar
commited on
Commit
·
3863911
1
Parent(s):
42a6f9c
update error handling
Browse files- src/populate.py +9 -6
src/populate.py
CHANGED
@@ -14,12 +14,15 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
|
16 |
df = pd.DataFrame.from_records(all_data_json)
|
17 |
-
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
23 |
return raw_data, df
|
24 |
|
25 |
|
|
|
14 |
all_data_json = [v.to_dict() for v in raw_data]
|
15 |
|
16 |
df = pd.DataFrame.from_records(all_data_json)
|
17 |
+
|
18 |
+
# Only keep the columns that actually exist in df
|
19 |
+
existing_cols = [c for c in cols if c in df.columns]
|
20 |
+
df = df[existing_cols]
|
21 |
+
|
22 |
+
# Also only filter out the benchmark columns that actually exist
|
23 |
+
existing_bench_cols = [c for c in benchmark_cols if c in df.columns]
|
24 |
+
df = df[has_no_nan_values(df, existing_bench_cols)]
|
25 |
+
|
26 |
return raw_data, df
|
27 |
|
28 |
|