def boxplot_sorted(df, by, column, **config):
    df2 = pd.DataFrame({col: vals[column] for (col, vals) in df.groupby(by)})
    meds = df2.median().sort_values()
    return df2[meds.index].boxplot(**config)
def boxplot_sorted(df, by, column, **config):
    df2 = pd.DataFrame({col: vals[column] for (col, vals) in df.groupby(by)})
    meds = df2.median().sort_values()
    return df2[meds.index].boxplot(**config)