Junetheriver commited on
Commit
c87780a
1 Parent(s): fe35dbb

trying to fix

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -39,9 +39,26 @@ def process_mc_df(df, shot=None):
39
  df = df.rename(columns={"name": "Model"})
40
  # 将zero_naive, zero_self_con, zero_cot, zero_cot_self_con, few_naive, few_self_con, few_cot, few_cot_self_con列重新组织成MultiIndex,一层为Zeroshot, Fewshot,一层为Naive, Self-Consistency, CoT, CoT+Self-Consistency
41
  df = df.set_index("Model")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  # df = df.stack().unstack()
43
  try:
44
- df.columns = pd.MultiIndex.from_tuples([("Zeroshot", "Naive"), ("Zeroshot", "SC"), ("Zeroshot", "CoT"), ("Zeroshot", "CoT+SC"), ("Fewshot", "Naive"), ("Fewshot", "SC"), ("Fewshot", "CoT"), ("Fewshot", "CoT+SC")])
45
  except:
46
  print(df)
47
  raise
 
39
  df = df.rename(columns={"name": "Model"})
40
  # 将zero_naive, zero_self_con, zero_cot, zero_cot_self_con, few_naive, few_self_con, few_cot, few_cot_self_con列重新组织成MultiIndex,一层为Zeroshot, Fewshot,一层为Naive, Self-Consistency, CoT, CoT+Self-Consistency
41
  df = df.set_index("Model")
42
+
43
+ columns = [col for col in df.columns if col != "Model"]
44
+
45
+ col_to_multi_index = {
46
+ "zero_naive": ("Zeroshot", "Naive"),
47
+ "zero_self_con": ("Zeroshot", "SC"),
48
+ "zero_cot": ("Zeroshot", "CoT"),
49
+ "zero_cot_self_con": ("Zeroshot", "CoT+SC"),
50
+ "few_naive": ("Fewshot", "Naive"),
51
+ "few_self_con": ("Fewshot", "SC"),
52
+ "few_cot": ("Fewshot", "CoT"),
53
+ "few_cot_self_con": ("Fewshot", "CoT+SC"),
54
+ }
55
+
56
+ columns = [col_to_multi_index[col] for col in df.columns]
57
+
58
+
59
  # df = df.stack().unstack()
60
  try:
61
+ df.columns = pd.MultiIndex.from_tuples(columns)
62
  except:
63
  print(df)
64
  raise