Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
Return a new RDD containing only the elements that satisfy a predicate.
Shraddheya Shendre
Programming language:
Python
2021-07-24 22:41:10
0
Q:
Return a new RDD containing only the elements that satisfy a predicate.
Sanjay
Code:
Python
2021-06-11 21:13:59
rdd = sc.parallelize([1, 2, 3, 4, 5]) rdd.filter(lambda x: x % 2 == 0).collect() # [2, 4]
0
Tags
new
element
con
turn
return
Related
Return a new RDD by applying a function to each element of this RDD.
Aggregate the elements of each partition, and then the results for all the partitions
Return a new RDD containing the distinct elements in this RDD.
Sorts this RDD, which is assumed to consist of (key, value) pairs
Applies a function to all elements of this RDD.
collections counter sort by value
Return an RDD created by coalescing all elements within each partition into a list.
Returns a new DataFrame containing the distinct rows in this DataFrame
find duplicated rows with respect to multiple columns pandas
Create a new RDD of int containing elements from start to end (exclusive), increased by step every element.
Return the number of elements in this RDD.
Group the values for each key in the RDD into a single sequence.
Reduces the elements of this RDD using the specified commutative and associative binary operator
Sorts this RDD by the given keyfunc
Return an RDD containing all pairs of elements with matching keys in self and other.
New to Communities?
Join the community