pyspark.pandas.groupby.SeriesGroupBy.unique

SeriesGroupBy.unique() → pyspark.pandas.series.Series

Return unique values in group.

Uniques are returned in order of unknown. It does NOT sort.

Examples

>>> df = ps.DataFrame({'a': [1, 1, 1, 2, 2, 2, 3, 3, 3],
...                    'b': [1, 2, 2, 2, 3, 3, 3, 4, 4]}, columns=['a', 'b'])
>>> df.groupby(['a'])['b'].unique().sort_index()  
a
1    [1, 2]
2    [2, 3]
3    [3, 4]
Name: b, dtype: object