0

I hope someone can help me with an error I am getting. I have a dataframe that is grouped together like this:

colour_group_revenue = type_colour.groupby(['Type','ColorID'])
colour_group_revenue.sum().sort_values(by='Total revenue', ascending = False)

This is the output:

my data:

I am then trying to create a grouped bar plot like this:

colour_group_revenue.pivot(index='Type', columns='ColorID', values='Quantity').plot(kind='bar')

However, I receive this error:

enter image description here

I just want to ask if there something I am missing here? Or is there a better way to create a grouped bar chart (if this is even possible with my output).

Thank you for any assistance.

Stuquan
  • 57
  • 6
  • store this result `colour_group_revenue.sum().sort_values(by='Total revenue', ascending = False)` into a variable then try pivoting on that variable – Anurag Dabas Jul 10 '21 at 10:36
  • Please [do not post images](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) of your data or errors. You can include [code that creates a dataframe or the output of `print(df)`](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) (or of a few rows and columns that allow to reproduce the example) – Cimbali Jul 10 '21 at 10:36

0 Answers0