如何在spark中将数据帧转换为csv

时间:2018-01-05 05:15:44

标签: apache-spark machine-learning pyspark

如何将数据帧转换为spark中的csv,读作

dataFrame = spark.read.csv("testData2.csv",header='true')

1 个答案:

答案 0 :(得分:1)

您尚未提及Spark版本。以下是选项

Spark 1.4 +

dataFrame.write.format('com.databricks.spark.csv').save('testdata.csv')

Spark 2.0 +

dataFrame.write.csv('testdata.csv')