pyspark.pandas.groupby.SeriesGroupBy.unique#

SeriesGroupBy.unique()[source]#

Return unique values in group.

Unique is 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