title: How to find the index of elements in a Pyspark RDD?
body: <p>This is my first question. I am coding in Pyspark. I have and RDD:</p>
  
  <pre><code>['a,b,c,d,e,f']
  </code></pre>
  
  <p>How do I find the index of the element 'e'?</p>
  
  <p>I tried zipWithIndex but its not giving me any index.</p>
  
  <p>I saw a similar question, but the solution mentioned did not return me the index</p>
  
  <pre><code>rdd.zipWithIndex().filter(lambda key,index : key == 'e') \
      .map(lambda key,index : index).collect()
  </code></pre>
  
  <p>I am getting an error.</p>
  
  <p>Please let me know how to find the index.</p>
  
  <p>Based on the solution provided:</p>
  
  <p>I still have a problem. My rdd is in this format:</p>
  
  <pre><code>['a,b,c,d,e,f']
  </code></pre>
  
  <p>So when I try : </p>
  
  <p>rdd.zipWithIndex().lookup('e')</p>
  
  <p>I get [ ]</p>
  
  <p>How should I proceed</p>
  
  <p>Thanks</p>