我正试图找出如何使用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))
目前没有回答
相关问题 更多 >
编程相关推荐