pandas groupby count unique values code example
Example 1: pandas count the number of unique values in a column
df['hID'].nunique()
5
Example 2: pandas groupby count unique rows
ID, domain
123, 'vk.com'
123, 'vk.com'
123, 'twitter.com'
456, 'vk.com'
456, 'facebook.com'
456, 'vk.com'
456, 'google.com'
789, 'twitter.com'
789, 'vk.com'