albertvillanova HF staff commited on
Commit
ea4c670
1 Parent(s): ccc567f

Extract concat_results function

Browse files
Files changed (1) hide show
  1. src/results.py +8 -3
src/results.py CHANGED
@@ -48,11 +48,16 @@ async def load_results_dataframes(*model_ids, result_paths_per_model=None):
48
  return result
49
 
50
 
51
- def display_results(task, hide_std_errors, show_only_differences, *dfs):
52
  dfs = [df.set_index("index") for df in dfs if "index" in df.columns]
53
- if not dfs:
 
 
 
 
 
 
54
  return None, None
55
- df = pd.concat(dfs)
56
  df = df.T.rename_axis(columns=None)
57
  return (
58
  display_tab("results", df, task, hide_std_errors=hide_std_errors),
 
48
  return result
49
 
50
 
51
+ def concat_results(dfs):
52
  dfs = [df.set_index("index") for df in dfs if "index" in df.columns]
53
+ if dfs:
54
+ return pd.concat(dfs)
55
+
56
+
57
+ def display_results(task, hide_std_errors, show_only_differences, *dfs):
58
+ df = concat_results(dfs)
59
+ if df is None:
60
  return None, None
 
61
  df = df.T.rename_axis(columns=None)
62
  return (
63
  display_tab("results", df, task, hide_std_errors=hide_std_errors),