GroupBy.
mean
Compute mean of groups, excluding missing values.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data.
New in version 3.4.0.
See also
pyspark.pandas.Series.groupby
pyspark.pandas.DataFrame.groupby
Examples
>>> df = ps.DataFrame({'A': [1, 1, 2, 1, 2], ... 'B': [np.nan, 2, 3, 4, 5], ... 'C': [1, 2, 1, 1, 2], ... 'D': [True, False, True, False, True]})
Groupby one column and return the mean of the remaining columns in each group.
>>> df.groupby('A').mean().sort_index() B C D A 1 3.0 1.333333 0.333333 2 4.0 1.500000 1.000000