I have two RDD's - RDD1 and RDD2 with following structure:
RDD1:
[(u'abc', 1.0), (u'cde', 1.0),....]
RDD2:
[3.0, 0.0,....]
Now I want to form a third RDD which values from each each index of the above two RDD's together. So the above output should become:
RDD3:
[(u'abc', 1.0,3.0), (u'cde', 1.0,0.0),....]
As you can see that values from RDD2 got added to tuples of RDD1. How can I do that? I tried to do RDD3 = RDD1.map(lambda x:x).zip(RDD2)
but it produces this output - [((u'abc', 1.0),3.0), ((u'cde', 1.0),0.0),....]
which is not what I want as you can see there's a separation between values of RDD1 and RDD2 by ()
.
NOTE: My RDD1 was formed using - RDD1 = data.map(lambda x:(x[0])).zip(val)