albertvillanova HF staff commited on
Commit
9e63bd6
1 Parent(s): 1582397

Simplify to_vertical

Browse files
Files changed (1) hide show
  1. app.py +2 -21
app.py CHANGED
@@ -65,8 +65,8 @@ def load_result(model_id):
65
 
66
 
67
  def to_vertical(df):
68
- # df = df.iloc[0].rename_axis("Parameters").rename(model_name).to_frame() # .reset_index()
69
- df = df.iloc[0].rename_axis("Parameters").to_frame() # .reset_index()
70
  df.index = df.index.str.join(".")
71
  return df
72
 
@@ -78,25 +78,6 @@ def to_dataframe(data):
78
  df.index = [data.get("model_name", "Model")]
79
  return df
80
 
81
- #
82
- # def to_dataframe_results(data):
83
- # dfs = {}
84
- # for key in data["results"]:
85
- # if key not in EXCLUDED_RESULTS_KEYS: # key.startswith("leaderboard_"):
86
- # name = key[len("leaderboard_"):]
87
- # df = to_dataframe(
88
- # {
89
- # key: value
90
- # for key, value in data["results"][key].items()
91
- # if key not in EXCLUDED_RESULTS_LEADERBOARDS_KEYS
92
- # }
93
- # )
94
- # # df.drop(columns=["alias"])
95
- # # df.columns = pd.MultiIndex.from_product([[name], df.columns])
96
- # df.columns = [f"{name}.{column}" for column in df.columns]
97
- # dfs[name] = df
98
- # return pd.concat(dfs.values(), axis="columns")
99
-
100
 
101
  def filter_results(df):
102
  df = df.loc[:, df.columns.str[0] == "results"]
 
65
 
66
 
67
  def to_vertical(df):
68
+ # df = df.iloc[0].rename_axis("Parameters").to_frame() # .reset_index()
69
+ df = df.T.rename_axis("Parameters")
70
  df.index = df.index.str.join(".")
71
  return df
72
 
 
78
  df.index = [data.get("model_name", "Model")]
79
  return df
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
  def filter_results(df):
83
  df = df.loc[:, df.columns.str[0] == "results"]