title: How to get the difference between two RDDs in PySpark?
body: <p>I'm trying to establish a cohort study to track in-app user behavior and I want ask if you have any idea about how i can exclude an element from an RDD 2 which is in RDD 1. Given :</p>
  
  <pre><code>rdd1 = sc.parallelize([("a", "xoxo"), ("b", 4)])
  
  rdd2 = sc.parallelize([("a", (2, "6play")), ("c", "bobo")])
  </code></pre>
  
  <p>For exemple, to have the common element between rdd1 and rdd2, we have just to do :</p>
  
  <pre><code>rdd1.join(rdd2).map(lambda (key, (values1, values2)) : (key, values2)).collect()
  </code></pre>
  
  <p>Which gives :</p>
  
  <pre><code>[('a', (2, '6play'))]
  </code></pre>
  
  <p>So, this join will find the common element between rdd1 and rdd2 and take key and values from rdd2 only. I want to do the opposite : find elements which are in rdd2 and not in rdd1, and take key and values from rdd2 only. In other words, I want to get items from rdd2 which aren't present in rdd1. So the expected output is : </p>
  
  <pre><code>("c", "bobo")
  </code></pre>
  
  <p>Ideas ? Thank you :)</p>