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_scientific(self, scientific: Option<bool>) -> Self
pub fn with_float_scientific(self, scientific: Option<bool>) -> Self
Set the CSV file’s forced scientific notation for floats.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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