pandas dataframe count distinct values in column code example
Example 1: count unique pandas
df['column'].nunique()
Example 2: how to get distinct value in a column dataframe in python
df.column.unique()
Example 3: how to count number of unique values in a column python
pd.value_counts(df.Account_Type)
Gold 3
Platinum 1
Name: Account_Type, dtype: int64
Example 4: distinct rows in this DataFrame
df.distinct().count()
Example 5: how to count unique values in a column dataframe in python
dataframe.column.nunique()
Example 6: Count unique values Pandas
df = df.groupby('domain')['ID'].nunique()