Suppose that df is a dataframe in Spark. The way to write df into a single CSV file is
df
df.coalesce(1).write.option(\"header\", \"tru
For pyspark, you can convert to pandas dataframe and then save it.
df.toPandas().to_csv("/", header=True, index=False)