Suppose I have this csv file:
CODE AGE GROUP SEX CITY
---- --------- --- ----
E101 25 to 29 M Denver
E102 25 to 29 F Denver
E105 25 to 29 M Denver
I wish to present it using a bar graph but I'm not sure how to count the number of males and females in it. This is what I've coded so far:
import matplotlib.pyplot as plt
plt.style.use('bmh')
x = df['SEX']
y = # what should I put here?
plt.xlabel('Sex', fontsize=16)
plt.ylabel('Number of people', fontsize=16)
plt.bar(x, y)
What should I put in "y" for it to count the number of males and females in the data?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…