how to count number of unique values in python code example Example: counting unique values python df.loc[df['mID']=='A','hID'].agg(['nunique','count','size'])