0

Hi Guys I have a dateset of some quizzes from various students categorized by learner category and group ID. I want to visualize the mean of total score on each of these group IDs (each learner category will be shown separately).based on syntaxes below I was able to find the mean. However, when I put it in box plot, 2 issues pop up:

1- Group_ID are not in order

2- Box plot does not shown completely.

Does anyone know how to solve this issues?

df_absbeg = df[df['Learner_Category'] == 'Absolute Beginner']
grouped_multiple = df_absbeg.groupby(['Group_ID']).agg({'Total_Score': ['mean']})
plotdf = grouped_multiple.pivot_table(index=['Group_ID'], values='Total_Score', aggfunc=np.mean)
plotdf.boxplot(by='Group_ID', column='mean', figsize=(20,6))

plot

JohanC
  • 71,591
  • 8
  • 33
  • 66
  • Note that if a boxplot only gets one input value per index, it can only draw a horizontal line there. You need many input values so the boxplot can indicate median, first and third quartile and outliers. – JohanC Jun 07 '20 at 14:04
  • Have a look at [natural sorting / human sorting](https://stackoverflow.com/questions/4836710/is-there-a-built-in-function-for-string-natural-sort) about how to order strings in a "human logical" way. ([related to pandas](https://stackoverflow.com/questions/29580978/naturally-sorting-pandas-dataframe)) – JohanC Jun 07 '20 at 14:06

0 Answers0