Pandas: Series - unique() function

Unique values of Series object in Pandas

The unique() function is used to get unique values of Series object.

Uniques are returned in order of appearance. Hash table-based unique, therefore does NOT sort.


Pandas Series unique image

Returns: ndarray or ExtensionArray
The unique values returned as a NumPy array. See Notes.

Notes: Returns the unique values as a NumPy array. In case of an extension-array backed Series, a new ExtensionArray of that type with just the unique values is returned. This includes

  • Categorical
  • Period
  • Datetime with Timezone
  • Interval
  • Sparse
  • IntegerNA


Download the Pandas Series Notebooks from here.

Previous: Sum of the values for the requested axis in Pandas
Next: Series containing counts of unique values in Pandas