SNIPPET
1 Upvote

Get Number of Unique Values in a Pandas DataFrame Column

Python
Visualisation & EDA

Returns the number of unique values that are present in a Pandas dataframe column.

unique_values = df['column_name'].nunique()
print('Number of Unique Values:', unique_values)

By analyseup - Last Updated Jan. 23, 2021, 8:43 p.m.

COMMENTS
RELATED SNIPPETS
2
Search Snippets by Tag: