【发布时间】:2015-07-08 15:08:26
【问题描述】:
我正在使用 pyspark 在 spark 中工作。当我使用下面的 lambda 时,我有一个格式为 [(key, (num, (min, max, count))),....] 的 rdd
t = fullBids.filter(lambda (value, stats): (stats[2] > 10 and stats[0] < value and value < stats[1]))
用
出错tuple index out of range
但是当我在 mapValues 调用中使用它时,它会成功运行,正确返回 True 或 False。
ti = fullBids.mapValues(lambda (value, stats): (stats[2] > 10 and stats[0] < value and value < stats[1]))
我希望过滤器能够正常工作,但事实并非如此。有人可以解释我在这里缺少什么吗?
【问题讨论】:
标签: python apache-spark pyspark