且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从数据框中获取价值

更新时间:2023-02-23 22:33:19

collect() 将结果作为 python 列表返回.要从列表中取出值,您只需要像这样获取第一个元素:

collect() returns your results as a python list. To get the value out of the list you just need to take the first element like this:

saleDF.groupBy("salesNum").mean()).collect()[0]