Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Dataframe to list pyspark

# convert student ID to list using
# flatMap
print(dataframe.select('student ID').
      rdd.flatMap(lambda x: x).collect())
Comment

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

PREVIOUS NEXT
Code Example
Python :: python remove a character from a string 
Python :: first and last name generator python 
Python :: structure ternaire python 
Python :: how to print in python 
Python :: Python - How To Check Operating System 
Python :: dockerfile to run python script 
Python :: python recognize every white color 
Python :: stack in python 
Python :: python check if ip is up or down 
Python :: how to get more than one longest string in a list python 
Python :: stop flask server 
Python :: tqdm 2 progress bars 
Python :: python clear stdout 
Python :: edit path variable using python 
Python :: reply_photo bot telegram python 
Python :: web socket in python 
Python :: python get attribute value with name 
Python :: discord.py read custom status 
Python :: python write into a file 
Python :: updateview 
Python :: create python dataframe 
Python :: groupby get last group 
Python :: max function python 
Python :: indentation in python 
Python :: how to get input from user in pyqt5 
Python :: any function in python 
Python :: how to repeat code in python until a condition is met 
Python :: to divide or not to divide solution 
Python :: rename rows pandas based on condiions 
Python :: dtype function with example 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =