Merge list of lists in pySpark RDD

前端 未结 2 1942
傲寒
傲寒 2021-01-15 17:23

I have lists of tuples that I want to combine into one list. I\'ve been able to process the data using lambdas and list comprehension to where I\'m close to being able to u

相关标签:
2条回答
  • 2021-01-15 17:35

    You can do,

    test = test.flatMap(identity)
    

    or

    test = test.flatMap(lambda list: list)
    
    0 讨论(0)
  • 2021-01-15 17:36

    Thanks to @mrsrinivas for providing the hint...

    test = test.flatMap(lambda xs: [(x[0], x[1]) for x in xs])

    0 讨论(0)
提交回复
热议问题