Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

list to dataframe pyspark

from pyspark.sql import Row
    li=[1,2,3,4]
    rdd1 = sc.parallelize(li)
    row_rdd = rdd1.map(lambda x: Row(x))
    df=sqlContext.createDataFrame(row_rdd,['numbers']).show()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #dataframe #pyspark
ADD COMMENT
Topic
Name
3+2 =