Convert RDD into Dataframe in pyspark
问题 I am trying to convert my RDD into Dataframe in pyspark. My RDD: [(['abc', '1,2'], 0), (['def', '4,6,7'], 1)] I want the RDD in the form of a Dataframe: Index Name Number 0 abc [1,2] 1 def [4,6,7] I tried: rd2=rd.map(lambda x,y: (y, x[0] , x[1]) ).toDF(["Index", "Name" , "Number"]) But I am getting errors An error occurred while calling z:org.apache.spark.api.python.PythonRDD.runJob. : org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 62.0 failed 1 times, most