View RDD contents in Python Spark?

后端 未结 6 933
醉酒成梦
醉酒成梦 2020-11-29 03:40

Running a simple app in pyspark.

f = sc.textFile(\"README.md\")
wc = f.flatMap(lambda x: x.split(\' \')).map(lambda x: (x, 1)).reduceByKey(add)
6条回答
  •  一个人的身影
    2020-11-29 04:26

    You can simply collect the entire RDD (which will return a list of rows) and print said list:

    print(wc.collect())
    

提交回复
热议问题