Spark - How to write a single csv file WITHOUT folder?

前端 未结 9 1225
北恋
北恋 2020-12-28 13:44

Suppose that df is a dataframe in Spark. The way to write df into a single CSV file is

df.coalesce(1).write.option(\"header\", \"tru

9条回答
  •  猫巷女王i
    2020-12-28 14:26

    For pyspark, you can convert to pandas dataframe and then save it.

    df.toPandas().to_csv("/", header=True, index=False)

提交回复
热议问题