O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Determining unique values (and their counts)

A list of unique values in a Series can be obtained using .unique():

The number of unique values (excluding NaN) can be obtained using .nunique():

To include NaN in the result, use dropna=False as a parameter.

The count of each unique value can be determined using .value_counts() (a process also known as Histogramming):

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required