Spark - RDD String

1 - Construction

2 - Transformation

2.1 - zipWithIndex

Add the line number as a value of a tuple ?

shakespeareRDD
       .zipWithIndex()  # to (line, lineNum)
       .map(lambda (l, num): '{0}: {1}'.format(num, l))  # to 'lineNum: line'
       .take(15))

where:

db/spark/string.txt ยท Last modified: 2017/09/06 20:15 by gerardnico