title: pyspark: 'PipelinedRDD' object is not iterable
body: <p>I am getting this error but i do not know why. 
  Basically I am erroring from this code: </p>
  
  <pre><code>    a = data.mapPartitions(helper(locations))
  </code></pre>
  
  <p>where data is an RDD and my helper is defined as:</p>
  
  <pre><code>    def helper(iterator, locations): 
          for x in iterator:
              c = locations[x]
              yield c
  </code></pre>
  
  <p>(locations is just an array of data points)
  I do not see what the problem is but I am also not the best at pyspark so can someone please tell me why I am getting 'PipelinedRDD' object is not iterable from this code?</p>