Dataset
Age factor1 factor2
20-25 0 1
26-30 0 0
31-35 1 0
20-25 1 1
26-30 0 1
20-25 1 0
I want to a line graph in python and groupby the value 'Age' (x-axis) and y-axis is the count of the number of times '1' comes in the factor1 column.
I tried the code below but it shows the count of number of times the 'age' category repeats instead of the count of 1 in factor1
df.groupby('Age')['factor1'].count().plot(kind='line')
plt.show()