pyarrow.csv.WriteOptions#

class pyarrow.csv.WriteOptions(include_header=None, *, batch_size=None, delimiter=None, eol=None, null_string=None, quoting_style=None, quoting_header=None)#

Bases: _Weakrefable

Options for writing CSV files.

Parameters:
include_headerbool, optional (default True)

Whether to write an initial header line with column names

batch_sizeint, optional (default 1024)

How many rows to process together when converting and writing CSV data

delimiter1-character str, optional (default “,”)

The character delimiting individual cells in the CSV data.

eolstr, optional (default “n”)

The end of line character to use for ending rows.

null_stringstr, optional (default “”)

The string to write for null values. Quotes are not allowed in this string.

quoting_stylestr, optional (default “needed”)

Whether to quote values, and if so, which quoting style to use. The following values are accepted:

  • “needed” (default): only enclose values in quotes when needed.

  • “all_valid”: enclose all valid values in quotes; nulls are not quoted.

  • “none”: do not enclose any values in quotes; values containing special characters (such as quotes, cell delimiters or line endings) will raise an error.

quoting_headerstr, optional (default “needed”)

Same as quoting_style, but for header column names. Accepts same values. Note : both “needed” and “all_valid” have the same effect of quoting all column names.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

validate(self)

Attributes

batch_size

How many rows to process together when converting and writing CSV data.

delimiter

The character delimiting individual cells in the CSV data.

eol

The end of line character to use for ending rows.

include_header

Whether to write an initial header line with column names.

null_string

The string to write for null values.

quoting_header

Same as quoting_style, but for header column names.

quoting_style

Whether to quote values, and if so, which quoting style to use.

batch_size#

How many rows to process together when converting and writing CSV data.

delimiter#

The character delimiting individual cells in the CSV data.

eol#

The end of line character to use for ending rows.

include_header#

Whether to write an initial header line with column names.

null_string#

The string to write for null values. Quotes are not allowed in this string.

quoting_header#

Same as quoting_style, but for header column names. Note : both “needed” and “all_valid” have the same effect of quoting all column names.

quoting_style#

Whether to quote values, and if so, which quoting style to use. The following values are accepted:

  • “needed” (default): only enclose values in quotes when needed.

  • “all_valid”: enclose all valid values in quotes; nulls are not quoted.

  • “none”: do not enclose any values in quotes; values containing special characters (such as quotes, cell delimiters or line endings) will raise an error.

validate(self)#