Saved data has undesired quotation marks

后端 未结 1 445
醉话见心
醉话见心 2021-01-25 01:43

I am using the following code to export my data frame to csv:

data.write.format(\'com.databricks.spark.csv\').options(delimiter=\"\\t\", codec=\"org.apache.hadoo         


        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-25 02:18

    You don't use all the options provided by the CSV writer. It has quoteMode parameter which takes one of the four values (descriptions from the org.apache.commons.csv documentation:

    • ALL - quotes all fields
    • MINIMAL (default) - quotes fields which contain special characters such as a delimiter, quotes character or any of the characters in line separator
    • NON_NUMERIC - quotes all non-numeric fields
    • NONE - never quotes fields

    If want to avoid quoting the last options looks a good choice, doesn't it?

    0 讨论(0)
提交回复
热议问题