0

I'm trying to create a bar chart with multiple columns in a dataframe. My dataframe looks something like this.

Age      Index 1     Index 2     Index 3     Index 4
18-30    20.000000  0.000000    0.000000    5.000000    
31-40    27.807487  6.746195    2.694364    1.069519    
41-50    45.499022  6.849315    1.663405    3.228963    
51-60    41.176471  0.000000    0.000000    11.764706

Desired output Chart

1
  • What have you tried so far?? Commented Jun 17, 2020 at 10:05

1 Answer 1

1

Create index by Age column (if necessary), then rename columns and last use DataFrame.plot.bar:

d = {'Index 1':'Payment', 'Index 2':'Gender Focus', 
     'Index 3':'H&S General', 'Index 4': 'H&S Covid 19'}
df.set_index('Age').rename(columns=d).plot.bar()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.