How to plot bar chart with first row as index?

Viewed 147

I have DataFrame with "sell of paints grouped by months and years":

Color    2012-04    2012-06 2012-07 2012-10 2013-06 
White       2.0     58.0    1.0     6.0     15.0 
Blue        1.0     0.0     0.0     0.0     0.0 
Red         33.0    54.0    18.0    24.0    27.0 
Green       16.0    0.0     0.0     12.0    6.0
Yellow      16.0    0.0     0.0     12.0    6.0

I want to make bar chart which show how many pcs of each color were sold in each month... So: x - should be date y. should be quantity of each color sold in according month

So, on x-axis in position 2012-04 there should be 4 bars with heights 2, 1, 33, 16 and 16 etc... Legend should contains colors of paint...

When I use df.plot.bar() x - is color y - is quantity sold in each month

For example:

First position on x axis is White, and I have 5 bars 2, 58, 1, 6 and 15. And legend says contains years and months.

I do not know if it is clear what i have wrote here.... but maybe someone can help?

1 Answers

df.set_index('Color').T.plot.bar()

Related