pandas.Series.unique¶
Return unique values of Series object.
Uniques are returned in order of appearance. Hash table-based unique, therefore does NOT sort.
- return
ndarray or ExtensionArray The unique values returned as a NumPy array. See Notes.
Limitations¶
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.
Examples¶
import pandas as pd
from numba import njit
@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]
print(series_unique())
$ python ./series/series_unique.py
[1 2 3]