How to convert a list of array to Spark dataframe
10,807
x = [[1,10],[2,14],[3,17]]
df = sc.parallelize(x).toDF(['ID','VALUE'])
df.show()
Related videos on Youtube
Author by
mommomonthewind
Updated on June 04, 2022Comments
-
mommomonthewind over 1 year
Suppose I have a list:
x = [[1,10],[2,14],[3,17]]
I want to convert
x
to a Spark dataframe with two columnsid
(1,2,3) andvalue
(10,14,17).How could I do that?
Thanks