to count how many unique numbers python code example
Example 1: python - count how many unique in a column
df['var_1'].nunique() # How many unque values are present in a variable
Example 2: counting unique values python
df.loc[df['mID']=='A','hID'].agg(['nunique','count','size'])
Example 3: count unique values in python
words = ['a', 'b', 'c', 'a']
unique_words = set(words) # == set(['a', 'b', 'c'])
unique_word_count = len(unique_words) # == 3