为什么PySpark中的agg()一次只能汇总一列? [英] Why agg() in PySpark is only able to summarize one column at a time?
本文介绍了为什么PySpark中的agg()一次只能汇总一列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于以下数据框
df=spark.createDataFrame(data=[('Alice',4.300),('Bob',7.677)],schema=['name','High'])
当我尝试查找min&最高我只会在输出中获得最小值.
When I try to find min & max I am only getting min value in output.
df.agg({'High':'max','High':'min'}).show()
+-----------+
|min(High) |
+-----------+
| 2094900|
+-----------+
为什么agg()不能同时给出max&像在熊猫里一样吗?
Why can't agg() give both max & min like in Pandas?
推荐答案
查看全文