Python Pandas count rows based on column

Viewed 9854

How to get row counts based on one column in Python pandas. For example I have a data frame like this:

Name         NameTitle    Sex

John         Dr           m
Mona         Dr           f
Mary         Mrs          f
Tom          Mr           m
Jack         Mr           m 
Leila        Ms           f
Soro         Ms           f 
Christi      Ms           f
Mike         Mr           m  

I need to count the number of name titles based on sex. Desired output would be like this:

NameTitle    Sex    Count

Dr           m      1
Dr           f      1
Mrs          f      1
Mr           m      3
Ms           f      3
1 Answers
Related