0
我想将不同的聚合函数应用于pyspark数据框中的不同列。继计算器一些建议,我尝试这样做:不同列上的不同聚合操作pyspark
the_columns = ["product1","product2"]
the_columns2 = ["customer1","customer2"]
exprs = [mean(col(d)) for d in the_columns1, count(col(c)) for c in the_columns2]
其次
df.groupby(*group).agg(*exprs)
其中,“组”是在任何the_columns或the_columns2不存在的列。这不起作用。如何在不同列上做不同的聚合函数?