pyspark.RDD.subtract#
- RDD.subtract(other, numPartitions=None)[source]#
Return each value in self that is not contained in other.
New in version 0.9.1.
- Parameters
- Returns
See also
Examples
>>> rdd1 = sc.parallelize([("a", 1), ("b", 4), ("b", 5), ("a", 3)]) >>> rdd2 = sc.parallelize([("a", 3), ("c", None)]) >>> sorted(rdd1.subtract(rdd2).collect()) [('a', 1), ('b', 4), ('b', 5)]