Table of Contents

Construction

Spark RDD - (Creation|Construction|Initialization)

Transformation

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: