Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create pyspark dataframe from list

dept = [("Finance",10), 
        ("Marketing",20), 
        ("Sales",30), 
        ("IT",40) 
      ]
deptColumns = ["dept_name","dept_id"]
deptDF = spark.createDataFrame(data=dept, schema = deptColumns)
deptDF.printSchema()
deptDF.show(truncate=False)
Source by sparkbyexamples.com #
 
PREVIOUS NEXT
Tagged: #create #pyspark #dataframe #list
ADD COMMENT
Topic
Name
7+6 =