df = df_logfile.groupby(['host', 'service'])['service'].agg({'no': 'count'})
mask = df.groupby(level=0).agg('idxmax')
df_count = df.loc[mask['no']]
Pandas, groupby and finding maximum in groups, returning value and count