how to aggregate data according to column pandas code example
Example 1: two groupby pandas
In [8]: grouped = df.groupby('A')
In [9]: grouped = df.groupby(['A', 'B'])
Example 2: Aggregate on the entire DataFrame without group
# Aggregate on the entire DataFrame without group
df.agg({"age": "max"}).collect()
# [Row(max(age)=5)]
from pyspark.sql import functions as F
df.agg(F.min(df.age)).collect()
# [Row(min(age)=2)]