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.
This commit is contained in:
Paul Gauthier 2023-06-29 19:05:16 -07:00
parent 937ee478ad
commit 0c9deaa118

View file

@ -57,7 +57,7 @@ def show_stats(dirnames):
df = pd.DataFrame.from_records(rows) df = pd.DataFrame.from_records(rows)
df.sort_values(by=["model", "edit_format"], inplace=True) 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)) fig, ax = plt.subplots(figsize=(10, 6))
df_grouped.unstack().plot(kind="barh", ax=ax) df_grouped.unstack().plot(kind="barh", ax=ax)