from pyspark.sql import functions as F df.groupBy("Profession").agg(F.mean('Age'), F.count('Age')).show()