Skip to main content

CsvReadOptions

Struct CsvReadOptions 

Source
pub struct CsvReadOptions {
Show 25 fields pub delimiter: u8, pub has_headers: bool, pub na_values: Vec<String>, pub keep_default_na: bool, pub na_filter: bool, pub index_col: Option<String>, pub usecols: Option<Vec<String>>, pub nrows: Option<usize>, pub skiprows: usize, pub dtype: Option<HashMap<String, DType>>, pub parse_dates: Option<Vec<String>>, pub parse_date_combinations: Option<Vec<Vec<String>>>, pub parse_date_combinations_named: Option<Vec<(String, Vec<String>)>>, pub comment: Option<u8>, pub true_values: Vec<String>, pub false_values: Vec<String>, pub decimal: u8, pub on_bad_lines: CsvOnBadLines, pub thousands: Option<u8>, pub skipfooter: usize, pub quotechar: u8, pub escapechar: Option<u8>, pub doublequote: bool, pub lineterminator: Option<u8>, pub skipinitialspace: bool,
}

Fields§

§delimiter: u8§has_headers: bool§na_values: Vec<String>

Additional NA values to recognize beyond the pandas defaults.

§keep_default_na: bool

Whether to include the default NaN values when parsing data. If na_values are specified and keep_default_na is false, only the specified na_values will be treated as NA. Matches pandas keep_default_na parameter. Default: true.

§na_filter: bool

Detect missing value markers (empty strings and the value of na_values). In data without any NAs, passing na_filter=false can improve performance. Matches pandas na_filter parameter. Default: true.

§index_col: Option<String>§usecols: Option<Vec<String>>

Read only these columns (by name). None means read all. Matches pandas usecols parameter.

§nrows: Option<usize>

Maximum number of data rows to read. None means read all. Matches pandas nrows parameter.

§skiprows: usize

Number of initial lines to skip at the start of the file (including the header line when has_headers is true). Matches pandas skiprows parameter (when given as int).

§dtype: Option<HashMap<String, DType>>

Force specific dtypes for columns. Map of column name -> DType. Matches pandas dtype parameter.

§parse_dates: Option<Vec<String>>

Column names to coerce via pandas-style parse_dates handling. Currently supports explicit column-name selection.

§parse_date_combinations: Option<Vec<Vec<String>>>

Column groups to combine and coerce via pandas-style parse_dates handling. Each group replaces its source columns with a new <a>_<b>_... datetime column.

§parse_date_combinations_named: Option<Vec<(String, Vec<String>)>>

Named column groups to combine and parse as datetime, matching pd.read_csv(parse_dates={'new_name': ['year', 'month', 'day']}). Each (new_name, [source_cols]) entry replaces its source columns with a single combined datetime column using the caller-supplied name instead of the default <a>_<b>_... joined form.

§comment: Option<u8>

Character whose lines are treated as comments and skipped entirely. Must be a single byte (ASCII); multi-byte characters are rejected. Matches pandas comment parameter. Default: None.

§true_values: Vec<String>

Additional string values to coerce to true during CSV parsing. Matches pandas true_values parameter.

§false_values: Vec<String>

Additional string values to coerce to false during CSV parsing. Matches pandas false_values parameter.

§decimal: u8

Character to recognize as the decimal separator when parsing floats. Matches pandas decimal parameter. Default: ..

§on_bad_lines: CsvOnBadLines

How to handle rows with more fields than the header width. Matches pandas on_bad_lines parameter for the supported error/warn/skip modes.

§thousands: Option<u8>

Thousands separator stripped from numeric fields before parsing. Matches pandas thousands parameter. Must differ from decimal (otherwise the option is silently ignored, matching pandas).

§skipfooter: usize

Number of trailing data rows to drop (after the header is consumed). Matches pandas skipfooter parameter. Default: 0.

§quotechar: u8

Character used to quote fields that contain the delimiter, a newline, or the quote character itself. Defaults to " (ASCII double-quote). Matches pandas quotechar parameter.

§escapechar: Option<u8>

Character used to escape the quote character inside a quoted field when doublequote is false. None disables backslash- style escaping entirely. Matches pandas escapechar parameter.

§doublequote: bool

When true (the default), a doubled quote character inside a quoted field is interpreted as a single literal quote. When false, escapechar must be used to quote the quote character. Matches pandas doublequote parameter.

§lineterminator: Option<u8>

Custom single-byte line terminator. When set, the reader treats only that byte as a record separator (instead of CRLF/LF). Matches pandas lineterminator (C-engine only). None keeps the default CRLF/LF handling.

§skipinitialspace: bool

When true, skip ASCII spaces (0x20 only, not tabs) immediately after a delimiter and at each field start, before quote handling. Matches pandas skipinitialspace (default false). Trailing spaces are preserved; spaces inside quoted fields are preserved; a space-then-quote field ( "x,y") is parsed as the quoted value.

Trait Implementations§

Source§

impl Clone for CsvReadOptions

Source§

fn clone(&self) -> CsvReadOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CsvReadOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CsvReadOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.