SeriesGroupBy.
value_counts
Compute group sizes.
Sort by frequencies.
Sort in ascending order.
Don’t include counts of NaN.
See also
pyspark.pandas.Series.groupby
pyspark.pandas.DataFrame.groupby
Examples
>>> df = ps.DataFrame({'A': [1, 2, 2, 3, 3, 3], ... 'B': [1, 1, 2, 3, 3, 3]}, ... columns=['A', 'B']) >>> df A B 0 1 1 1 2 1 2 2 2 3 3 3 4 3 3 5 3 3
>>> df.groupby('A')['B'].value_counts().sort_index() A B 1 1 1 2 1 1 2 1 3 3 3 Name: B, dtype: int64