df_logfile = pd.DataFrame({'host': ['this.com', 'this.com', 'this.com',
    'that.com', 'other.net', 'other.net', 'other.net'], 'service': ['mail',
    'mail', 'web', 'mail', 'mail', 'web', 'web']})
df = df_logfile.groupby(['host', 'service'])['service'].agg({'no': 'count'})
Pandas, groupby and finding maximum in groups, returning value and count