它可以在没有聚合或计数的情况下遍历 Pyspark groupBy 数据帧吗?
例如 Pandas 中的代码:
for i, d in df2:
mycode ....
^^ if using pandas ^^
Is there a difference in how to iterate groupby in Pyspark or have to use aggregation and count?
最佳答案
当我们执行 GroupBy 时,我们最终会得到一个 RelationalGroupedDataset,这是一个 DataFrame 的奇特名称,它指定了一个分组,但需要用户在进一步查询之前指定一个聚合。
当您尝试在 Grouped 数据帧上执行任何功能时,它会引发错误
AttributeError: 'GroupedData' object has no attribute 'show'
关于python - Pyspark groupBy DataFrame 没有聚合或计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59622573/