How do you count unique values in a list Python? code example Example: counting unique values python df.loc[df['mID']=='A','hID'].agg(['nunique','count','size'])