My dataframe round_data
looks like this:
error username task_path
0 0.02 n49vq14uhvy93i5uw33t
ok, I figured out the answer:
grouped = round_data[round_data.batch==i].groupby("username")
users_sorted_average = pd.DataFrame({col:vals['absolute_error'] for col,vals in grouped}).mean().sort_values(ascending=True)
passing users_sorted_average
for the "order" parameter in the seaborn plot function would give the desired behavior:
ax = sns.boxplot(x="username", y="error", data=round_data,
whis=np.inf,ax=ax,color=c,order=users_sorted_average.index)