Issue
Well, I'm new to Python family and need some help.
I have a Python Dataframe as below:
Name | rslt1 | rslt2 | rslt3 | rslt4 |
---|---|---|---|---|
A | 1 | 0 | 0 | 0 |
B | 1 | 0 | 0 | 1 |
C | 1 | 1 | 0 | 0 |
D | 1 | 0 | 1 | 0 |
E | 1 | 1 | 0 | 0 |
And want to come up with a plot like below :
How can I achieve that ?
Solution
Firstly, please add code as text, not images.
But you can achieve that with the following:
df = pd.DataFrame({
'name': ['A', 'B', 'C'],
'result1': [1, 0, 0],
'result2': [1, 0, 1],
})
series = df.set_index('name').sum()
series.plot.bar()
Answered By - Collin Cunningham
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.