Write the contents of the Frame into a CSV file.
This method uses multiple threads to serialize the Frame’s data. The
number of threads is can be configured using the global option
The method supports simple writing to file, appending to an existing file, or creating a python string if no filename was provided. Optionally, the output could be gzip-compressed.
Path to the output CSV file that will be created. If the file already exists, it will be overwritten. If no path is given, then the Frame will be serialized into a string, and that string will be returned.
Field separator, must be a single-character string. To be
able to read the resulting CSV file back to datatable,
the separator should meet requirements of
Quote the string fields only as necessary, i.e. if the string starts or ends with the whitespace, or contains quote characters, separator, or any of the C0 control characters (including newlines, etc).
Fields for all the column types will be quoted.
All string fields will be quoted.
None of the fields will be quoted. This option must be used at user’s own risk: the file produced may not be valid CSV.
must be imported first.
This option controls whether or not to write headers into the
output file. If this option is not given (or equal to …), then
the headers will be written unless the option
append is True
and the file
path already exists. Thus, by default the headers
will be written in all cases except when appending content into
an existing file.
If True, then insert the byte-order mark into the output file (the option is False by default). Even if the option is True, the BOM will not be written when appending data to an existing file.
According to Unicode standard, including BOM into text files is “neither required nor recommended”. However, some programs (e.g. Excel) may not be able to recognize file encoding without this mark.
If True, then all floating-point values will be printed in hex
format (equivalent to %a format in C
printf). This format is
around 3 times faster to write/read compared to usual decimal
representation, so its use is recommended if you need maximum
Which compression method to use for the output stream. The default
is “auto”, which tries to infer the compression method from the
output file’s name. The only compression format currently supported
is “gzip”. Compression may not be used when
append is True.
If True, some extra information will be printed to the console, which may help to debug the inner workings of the algorithm.
Which method to use for writing to disk. On certain systems ‘mmap’ gives a better performance; on other OSes ‘mmap’ may not work at all.
path is non-empty. This is the most common case: the
output is written to the file provided.
String containing the CSV text as if it would have been written to a file, if the path is empty or None. If the compression is turned on, a bytes object will be returned instead.