Skip to content Skip to sidebar Skip to footer

How To Get Specific Values From Rdd In Spark With Pyspark

The following is my RDD, there are 5 fields [('sachin', 200, 10,4,True), ('Raju', 400, 40,4,True), ('Mike', 100, 50,4,False) ] Here I need to fetch 1st ,3rd and 5th Fields only ,

Solution 1:

With a simple map?

rdd.map(lambda x: (x[0], x[2], x[4]))

Post a Comment for "How To Get Specific Values From Rdd In Spark With Pyspark"