Star Wars Survey. Need help with a bar chart

Screen Link:

My Code:

edu_rank = edu.groupby('Education')[edu.columns[9:15]].mean()

## reindexing columns' labels
edu_rank.columns = edu_rank.columns.str.replace('ranking_','Episode ')


I would like to plot a barh where the y axis are the episodes and on the x axis the average ranking as grouped before

What actually happened:


But it’s plotted exactly in the reverse sense.

Would you know how could I solve this issue?

Thank you!

Hi @giovanni.srg

Too late of a response but have you tried using options like providing x and y-axis similar to ‘kind’ argument?
pandas.DataFrame.plot — pandas 1.3.0 documentation (

or may be a simple dataframe.T.plot(kind = "barh")
assuming you only have two columns in the edu_rank dataframe. So transpose and then plot?

Let me know if this turned out to be a lame suggestion.

1 Like

That’s a nice suggestion. I solved before by just using transpose to invert columns and rows of the df

1 Like

Oh Cool @giovanni.srg !

1 Like