Advertisement
fahadkalil

criar_rdd_spark

Nov 1st, 2019
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. from pyspark.sql import Row
  2.  
  3. lista = [('Joao',25),('Paulo',22)]
  4. rdd = sc.parallelize(lista)
  5. pessoa = rdd.map(lambda x: Row(nome=x[0], idade=int(x[1])))
  6. schemaPessoa = sqlContext.createDataFrame(pessoa)
  7.  
  8. display(schemaPessoa)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement