writeCsv
Write DataFrame to CSV File
Writes this DataFrame to a CSV file.
Parameters you can use to customize the process include, for instance, delimiter, includeHeader, quoteMode, and headerComments. See the param list below for all settings.
The integration is built upon Apache Commons CSV.
Similar Functions
With overloads of DataFrame.writeCsv(), you can write CSV to File, Path, Appendable, or String.
For example, DataFrame.writeCsv("output.csv")
or DataFrame.writeCsv(File("output.csv"), quoteMode = QuoteMode.ALL)
Converting to a String can be done like this:
DataFrame.toCsvStr(delimiter = ",")
Parameters
The path pointing to a file to write to.
The field delimiter character. Default: ','.
Ignored if hasFixedWidthColumns is true.
Whether to include the header in the output. Default: true.
The quote character. Default: ".
Used when field- or line delimiters should be interpreted as literal text.
For example: 123,"hello, there",456, would correspond to: 123; hello, there; 456.
The QuoteMode to use when writing CSV / TSV files. Default: QuoteMode.MINIMAL.
The escape character to use when writing CSV / TSV files with QuoteMode.NONE. Default: null. This will double-quote the value.
The character that indicates a comment line in a CSV / TSV file. Default: '#'.
A list of comments to include at the beginning of the CSV / TSV file. Default: empty list.
The character that separates records in a CSV / TSV file. Default: '\n', a Unix-newline.
Write DataFrame to CSV File
Writes this DataFrame to a CSV file.
Parameters you can use to customize the process include, for instance, delimiter, includeHeader, quoteMode, and headerComments. See the param list below for all settings.
The integration is built upon Apache Commons CSV.
Similar Functions
With overloads of DataFrame.writeCsv(), you can write CSV to File, Path, Appendable, or String.
For example, DataFrame.writeCsv("output.csv")
or DataFrame.writeCsv(File("output.csv"), quoteMode = QuoteMode.ALL)
Converting to a String can be done like this:
DataFrame.toCsvStr(delimiter = ",")
Parameters
The file to write to.
The field delimiter character. Default: ','.
Ignored if hasFixedWidthColumns is true.
Whether to include the header in the output. Default: true.
The quote character. Default: ".
Used when field- or line delimiters should be interpreted as literal text.
For example: 123,"hello, there",456, would correspond to: 123; hello, there; 456.
The QuoteMode to use when writing CSV / TSV files. Default: QuoteMode.MINIMAL.
The escape character to use when writing CSV / TSV files with QuoteMode.NONE. Default: null. This will double-quote the value.
The character that indicates a comment line in a CSV / TSV file. Default: '#'.
A list of comments to include at the beginning of the CSV / TSV file. Default: empty list.
The character that separates records in a CSV / TSV file. Default: '\n', a Unix-newline.
Write DataFrame to CSV Appendable
Writes this DataFrame to a CSV Appendable.
Parameters you can use to customize the process include, for instance, delimiter, includeHeader, quoteMode, and headerComments. See the param list below for all settings.
The integration is built upon Apache Commons CSV.
Similar Functions
With overloads of DataFrame.writeCsv(), you can write CSV to File, Path, Appendable, or String.
For example, DataFrame.writeCsv("output.csv")
or DataFrame.writeCsv(File("output.csv"), quoteMode = QuoteMode.ALL)
Converting to a String can be done like this:
DataFrame.toCsvStr(delimiter = ",")
Parameters
The Appendable to write to.
The field delimiter character. Default: ','.
Ignored if hasFixedWidthColumns is true.
Whether to include the header in the output. Default: true.
The quote character. Default: ".
Used when field- or line delimiters should be interpreted as literal text.
For example: 123,"hello, there",456, would correspond to: 123; hello, there; 456.
The QuoteMode to use when writing CSV / TSV files. Default: QuoteMode.MINIMAL.
The escape character to use when writing CSV / TSV files with QuoteMode.NONE. Default: null. This will double-quote the value.
The character that indicates a comment line in a CSV / TSV file. Default: '#'.
A list of comments to include at the beginning of the CSV / TSV file. Default: empty list.
The character that separates records in a CSV / TSV file. Default: '\n', a Unix-newline.
Optional extra CSVFormat configuration. Default: { it }.
Before instantiating the CSVFormat, the CSVFormat.Builder will be passed to this lambda. This will allow you to configure/overwrite any CSV / TSV writing options.