return a new rdd containing only the elements that satisfy a predicate

Solutions on MaxInterview for return a new rdd containing only the elements that satisfy a predicate by the best coders in the world

showing results for - "return a new rdd containing only the elements that satisfy a predicate "
Antonia
22 Sep 2017
1rdd = sc.parallelize([1, 2, 3, 4, 5])
2rdd.filter(lambda x: x % 2 == 0).collect()
3# [2, 4]