From 0c9deaa118e5707b973fb2bdcea6dc3b5812bd7d Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 29 Jun 2023 19:05:16 -0700 Subject: [PATCH] aider: Sort the grouped columns by descending average. # Context: USER: sort the grouped columns by descending average ASSISTANT: To sort the grouped columns by descending average, we need to modify the `show_stats` function in the `benchmark/benchmark.py` file. Specifically, we need to sort the `df_grouped` DataFrame by its values in descending order. Here is the change: ```python benchmark/benchmark.py <<<<<<< ORIGINAL df_grouped = df.groupby(["model", "edit_format"])["pass_rate_1"].mean() ======= df_grouped = df.groupby(["model", "edit_format"])["pass_rate_1"].mean().sort_values(ascending=False) >>>>>>> UPDATED ``` This change will sort the grouped DataFrame `df_grouped` by its values in descending order. The `ascending=False` argument in the `sort_values` function ensures that the sorting is done in descending order. --- benchmark/benchmark.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index a5c9de9b0..599ec0efb 100755 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -57,7 +57,7 @@ def show_stats(dirnames): df = pd.DataFrame.from_records(rows) df.sort_values(by=["model", "edit_format"], inplace=True) - df_grouped = df.groupby(["model", "edit_format"])["pass_rate_1"].mean() + df_grouped = df.groupby(["model", "edit_format"])["pass_rate_1"].mean().sort_values(ascending=False) fig, ax = plt.subplots(figsize=(10, 6)) df_grouped.unstack().plot(kind="barh", ax=ax)