Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: How to take space-separated integer input in Python 3 
Python :: Python string to var 
Python :: converting numpy array to dataframe 
Python :: get last 3 in array python 
Python :: kubernetes python client 
Python :: function for detecting outliers in python 
Python :: django textfield 
Python :: how to give a role permissions discord py 
Python :: find string in string python 
Python :: Iterate string 2 characters at a time in python 
Python :: how to get key value in nested dictionary python 
Python :: python how to show package version 
Python :: how to slice a string in python 
Python :: convert to datetime object 
Python :: domain name of my site 
Python :: pandas replace nan with none 
Python :: how to get median mode average of a python list 
Python :: infinite while python 
Python :: count elements in columns pandas 
Python :: generate random integers in a range python 
Python :: start a django project 
Python :: entropy formula pyhon 
Python :: python check if list contains value 
Python :: datetime.time to seconds 
Python :: double in python 
Python :: insert row in any position pandas dataframe 
Python :: how to merge between two columns and make a new one in pandas dataframe 
Python :: insert column in a dataframe 
Python :: python compiler to exe 
Python :: python dict comprehension 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =