Spark RDD - String

Spark Pipeline

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:







Share this page:
Follow us:
Task Runner