我无法修复(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()
Python 3不支持
(x, (y,z))
,其中(y,z)
将是子列表参数你可以把这一行改写为
让我知道这是否适合你
相关问题 更多 >
编程相关推荐