pyspark - Concatenate elements in rdd list python spark -


i have rdd below,

>>> rdd.collect() [([u'steve'], [u'new', u'york'], [u'baseball']), ([u'smith'], [u'virginia'], [u'football'])] 

how can new rdd as,

[([u'steve'], [u'newyork'], [u'baseball']), ([u'smith'], [u'virginia'], [u'football'])] 

i tried map new rdd join doesnot work

i able fix this,

>>> rdd2=rdd.map(lambda l: [''.join(x) x in l]) >>> rdd2.map(tuple).collect() [([u'steve'], [u'newyork'], [u'baseball']), ([u'smith'], [u'virginia'], [u'football'])] 

Comments