I have a DataFrame and would like to make grouped boxplots for a selection of data with certain labels (list boxplots). The boxplot should show values and add a line showing the average value for the values in each group of boxplots.
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0,30,size=(100, 4)), columns=list('ABCD'))
label = ['A','B','C','D','E','F']
df['label'] = np.random.choice(label, df.shape[0])
boxplots = ['A', 'D']
I can't really figure out how to make grouped boxplots? Do I iterate through the boxplots list and then add them to a plot in each iteration?
Any thoughts are much appreciated!