Return unique values of Series object.

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


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


  • Return values order is unspecified

  • This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff

    between staying in JIT-region with that function or going back to interpreter mode.


Getting unique values in Series
import pandas as pd
from numba import njit

def series_unique():
    s = pd.Series([2, 1, 3, 3])
    out_series = s.unique()

    return out_series  # Expect array of unique values [1, 2, 3]

$ python ./series/
[1 2 3]