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.

SadSalad
  • 69
  • 2
  • 12
  • 1
    You should check out this question similar to yours [here](https://stackoverflow.com/questions/47339352/how-do-i-convert-this-csv-data-into-a-bar-chart/47339510) – Sash May 28 '20 at 16:11

1 Answers1

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)
Sheila Mbadi
  • 116
  • 5