pyspark aggregate multiple columns in a dataframe at once code example
Example: Pyspark Aggregation on multiple columns
df.groupBy("year", "sex").agg(avg("percent"), count("*"))
df.groupBy("year", "sex").agg(avg("percent"), count("*"))