w3resource

Pandas: Data Manipulation - unique() function

unique() function

Hash table-based unique. Uniques are returned in order of appearance. This does NOT sort.
Significantly faster than numpy.unique. Includes NA values.

Syntax:

pandas.unique(values)

Parameters:

Name Description Type Required / Optional
values 1d array-like Required

Returns: numpy.ndarray or ExtensionArray

    The return can be:
  • Index : when the input is an Index
  • Categorical : when the input is a Categorical dtype
  • ndarray : when the input is a Series/ndarray

  • Return numpy.ndarray or ExtensionArray.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: factorize() function
Next: wide_to_long() function



Follow us on Facebook and Twitter for latest update.