0

I have a CSV file customer:

-------------------------------------------
index | age_group | female | male | total |
-------------------------------------------
  0       16-20       23      5      28   |
  1       20-26       66      12     78   |
  2       26-32       12      3      15   |
 ...       ...        ..     ...     ..   |
-------------------------------------------

I want to make a barchart to show the relationship between age group and total and a barchart to show the relationship between different gender and total.

1
  • 1
    You should check out this question similar to yours here Commented May 28, 2020 at 16:11

1 Answer 1

2

I used pandas to do the plotting.

import pandas as pd

# Barchart to show the relationship between age group and total
df.plot.bar(x='age_group', y='total', rot=0)

# Barchart to show the relationship between different gender and total
df.plot.bar(x='age_group', y=['female', 'male'], rot=0)
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.