pub struct CsvWriter<W: Write> { /* private fields */ }
Available on crate features
csv
or json
only.Expand description
Write a DataFrame to csv.
Don’t use a Buffered
writer, the CsvWriter
internally already buffers writes.
Implementations§
source§impl<W> CsvWriter<W>where
W: Write,
impl<W> CsvWriter<W>where
W: Write,
sourcepub fn include_bom(self, include_bom: bool) -> Self
pub fn include_bom(self, include_bom: bool) -> Self
Set whether to write UTF-8 BOM.
sourcepub fn include_header(self, include_header: bool) -> Self
pub fn include_header(self, include_header: bool) -> Self
Set whether to write headers.
sourcepub fn with_separator(self, separator: u8) -> Self
pub fn with_separator(self, separator: u8) -> Self
Set the CSV file’s column separator as a byte character.
sourcepub fn with_batch_size(self, batch_size: NonZeroUsize) -> Self
pub fn with_batch_size(self, batch_size: NonZeroUsize) -> Self
Set the batch size to use while writing the CSV.
sourcepub fn with_date_format(self, format: Option<String>) -> Self
pub fn with_date_format(self, format: Option<String>) -> Self
Set the CSV file’s date format.
sourcepub fn with_time_format(self, format: Option<String>) -> Self
pub fn with_time_format(self, format: Option<String>) -> Self
Set the CSV file’s time format.
sourcepub fn with_datetime_format(self, format: Option<String>) -> Self
pub fn with_datetime_format(self, format: Option<String>) -> Self
Set the CSV file’s datetime format.
sourcepub fn with_float_precision(self, precision: Option<usize>) -> Self
pub fn with_float_precision(self, precision: Option<usize>) -> Self
Set the CSV file’s float precision.
sourcepub fn with_quote_char(self, char: u8) -> Self
pub fn with_quote_char(self, char: u8) -> Self
Set the single byte character used for quoting.
sourcepub fn with_null_value(self, null_value: String) -> Self
pub fn with_null_value(self, null_value: String) -> Self
Set the CSV file’s null value representation.
sourcepub fn with_line_terminator(self, line_terminator: String) -> Self
pub fn with_line_terminator(self, line_terminator: String) -> Self
Set the CSV file’s line terminator.
sourcepub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
pub fn with_quote_style(self, quote_style: QuoteStyle) -> Self
Set the CSV file’s quoting behavior.
See more on QuoteStyle
.
pub fn n_threads(self, n_threads: usize) -> Self
pub fn batched(self, schema: &Schema) -> PolarsResult<BatchedWriter<W>>
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for CsvWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for CsvWriter<W>where
W: RefUnwindSafe,
impl<W> Send for CsvWriter<W>where
W: Send,
impl<W> Sync for CsvWriter<W>where
W: Sync,
impl<W> Unpin for CsvWriter<W>where
W: Unpin,
impl<W> UnwindSafe for CsvWriter<W>where
W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more