我一直在Jupyter笔记本上发现这个错误

2024-03-29 08:46:45 发布

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

我正试图找出如何使用Jupyter笔记本,我做了一个练习。然而,在我运行它之后,我不断地得到一个错误。对可能出现的问题有什么建议吗

import findspark
findspark.init()

from pyspark import SparkConf, SparkContext
import collections

conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)

lines = sc.textFile("file:///SparKContent/ml-100k/u.data")
ratings = lines.map(lambda x: x.split()[2])
result = ratings.countByValue()

sortedResults = collections.OrderedDict(sorted(result.items()))
for key, value in sortedResults.items():
print("%s %i" % (key, value))

Error message

error message cont.