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