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 :: access sqlite db python 
Python :: how to find 1 st digit in python 
Python :: pandas iterrows 
Python :: get ContentType with django get_model 
Python :: pandas distinct 
Python :: # time delay in python script 
Python :: how to append list to list in python 
Python :: rotate 90 degrees clockwise counter python 
Python :: python letter to number in alphabet 
Python :: timestamp to date time till milliseconds python 
Python :: python check for duplicate 
Python :: Save a Dictionary to File in Python Using the dump Function of the pickle Module 
Python :: get text selenium 
Python :: matplotlib overlapping labels 
Python :: how to get unique value of all columns in pandas 
Python :: terms for list of substring present in another list python 
Python :: python split list into n sublists 
Python :: Clear All the Chat in Discord Channel With Bot Python COde 
Python :: py env 
Python :: django fixtures. To dump data 
Python :: python how to keep turtle window open 
Python :: from math import python 
Python :: set value based on column 
Python :: element wise subtraction python list 
Python :: how to clear ipython console 
Python :: python vs c++ 
Python :: python add to file 
Python :: script python to download videio from any website 
Python :: check integer number python 
Python :: python pdf fpdf example 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =