The function name is flatMap - with capital M to match the Scala API.








—
Sent from Mailbox

On Sun, Dec 13, 2015 at 7:40 PM, Abhishek Shivkumar
<[email protected]> wrote:

> Hi,
>     I have a RDD of many items.
> Each item has a key and its value is a list of elements.
> I want to unpack the elements of the item so that I can create a new RDD
> with each of its item being the original key and one single element.
> I tried doing RDD.flatmap(lambda line: [ (line[0], v) for v in line[1]])
> but it throws an error saying "AttributeError: 'PipelinedRDD' object has no
> attribute 'flatmap"
> Can someone tell me the right way to unpack the values to different items
> in the new RDD?
> Thank you!
> With Regards,
> Abhishek S

Reply via email to