pyspark.pandas.groupby.GroupBy.count

GroupBy.count() → FrameLike[source]

Compute count of group, excluding missing values.

Examples

>>> df = ps.DataFrame({'A': [1, 1, 2, 1, 2],
...                    'B': [np.nan, 2, 3, 4, 5],
...                    'C': [1, 2, 1, 1, 2]}, columns=['A', 'B', 'C'])
>>> df.groupby('A').count().sort_index()  
    B  C
A
1  2  3
2  2  2