Pyspark Group по и среднему в DataFrames
df.groupBy("Profession").agg({'Age':'avg', 'Gender':'count'}).show()
Fine Falcon
df.groupBy("Profession").agg({'Age':'avg', 'Gender':'count'}).show()
from pyspark.sql import functions as F
df.groupBy("Profession").agg(F.mean('Age'), F.count('Age')).show()