Convert a spark DataFrame to pandas DF

后端 未结 3 1484
-上瘾入骨i
-上瘾入骨i 2020-12-08 18:38

Is there a way to convert a Spark Df (not RDD) to pandas DF

I tried the following:

var some_df = Seq(
 (\"A\", \"no\"),
 (\"B\", \"yes\"),
 (\"B\", \         


        
3条回答
  •  隐瞒了意图╮
    2020-12-08 19:26

    following should work

    some_df = sc.parallelize([
     ("A", "no"),
     ("B", "yes"),
     ("B", "yes"),
     ("B", "no")]
     ).toDF(["user_id", "phone_number"])
    pandas_df = some_df.toPandas()
    

提交回复
热议问题