I create a dataset like that,
Gender    response
female    yes
male      yes
female    yes
female    no
male      yes
female    no
male      yes
male      no
female    no
I like to count the yes responses and no responses genderwise. Like there are two females who said No and 2 females who said yes. There are three males said yes and one said no.
I tried to implement this using pandas dataframe.
So far I have tried to write down the query like
df.loc[df['Gender'] == 'female' & (df['response'] == 'yes')]
But I got error. How could I write it down?
Thank you.
df.groupby(['Gender', 'response'], as_index=False).size()