df.columns.unique.count code example Example 1: pandas count the number of unique values in a column df['hID'].nunique() 5 Example 2: pandas count unique values in column df.nunique()