Python3 for Hadoop不支持子列表参数

2024-10-04 01:23:58 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法修复(lambda(x,(y,z)):[(dest,z/len(y))的此问题

错误消息 Python 3.xPylance中不支持子列表参数

仅位置参数分隔符不允许作为第一个参数

  print "Run 30 Iterations"
for i in range(1, 30):
    print "Number of Iterations"
    print i
    JoinRDD = AdjList3.join(PageRankValues)
    print "join results"
    print JoinRDD.collect()
    contributions = JoinRDD.flatMap(lambda (x, (y, z)) : [(dest, z/len(y)) for dest in y])  # 4. Replace the lambda function with yours
    print "contributions"
    print contributions.collect()
    accumulations = contributions.reduceByKey(lambda x, y : x + y)  # 5. Replace the lambda function with yours
    print "accumulations"
    print accumulations.collect()
    PageRankValues = accumulations.mapValues(lambda v : 0.85 * v + 0.15 / float(nNumOfNodes))  # 6. Replace the lambda function with yours
    print "PageRankValues"
    print PageRankValues.collect() 

Tags: thelambda参数lenwithfunctionreplacedest