pub struct CsvReadOptions {Show 20 fields
pub path: Option<PathBuf>,
pub rechunk: bool,
pub n_threads: Option<usize>,
pub low_memory: bool,
pub n_rows: Option<usize>,
pub row_index: Option<RowIndex>,
pub columns: Option<Arc<[PlSmallStr]>>,
pub projection: Option<Arc<Vec<usize>>>,
pub schema: Option<Arc<Schema<DataType>>>,
pub schema_overwrite: Option<Arc<Schema<DataType>>>,
pub dtype_overwrite: Option<Arc<Vec<DataType>>>,
pub parse_options: Arc<CsvParseOptions>,
pub has_header: bool,
pub chunk_size: usize,
pub skip_rows: usize,
pub skip_rows_after_header: usize,
pub infer_schema_length: Option<usize>,
pub raise_if_empty: bool,
pub ignore_errors: bool,
pub fields_to_cast: Vec<Field>,
}
polars-io
only.Fields§
§path: Option<PathBuf>
§rechunk: bool
§n_threads: Option<usize>
§low_memory: bool
§n_rows: Option<usize>
§row_index: Option<RowIndex>
§columns: Option<Arc<[PlSmallStr]>>
§projection: Option<Arc<Vec<usize>>>
§schema: Option<Arc<Schema<DataType>>>
§schema_overwrite: Option<Arc<Schema<DataType>>>
§dtype_overwrite: Option<Arc<Vec<DataType>>>
§parse_options: Arc<CsvParseOptions>
§has_header: bool
§chunk_size: usize
§skip_rows: usize
§skip_rows_after_header: usize
§infer_schema_length: Option<usize>
§raise_if_empty: bool
§ignore_errors: bool
§fields_to_cast: Vec<Field>
Implementations§
Source§impl CsvReadOptions
impl CsvReadOptions
pub fn get_parse_options(&self) -> Arc<CsvParseOptions>
pub fn with_path<P>(self, path: Option<P>) -> CsvReadOptions
Sourcepub fn with_rechunk(self, rechunk: bool) -> CsvReadOptions
pub fn with_rechunk(self, rechunk: bool) -> CsvReadOptions
Whether to makes the columns contiguous in memory.
Sourcepub fn with_n_threads(self, n_threads: Option<usize>) -> CsvReadOptions
pub fn with_n_threads(self, n_threads: Option<usize>) -> CsvReadOptions
Number of threads to use for reading. Defaults to the size of the polars thread pool.
Sourcepub fn with_low_memory(self, low_memory: bool) -> CsvReadOptions
pub fn with_low_memory(self, low_memory: bool) -> CsvReadOptions
Reduce memory consumption at the expense of performance
Sourcepub fn with_n_rows(self, n_rows: Option<usize>) -> CsvReadOptions
pub fn with_n_rows(self, n_rows: Option<usize>) -> CsvReadOptions
Limits the number of rows to read.
Sourcepub fn with_row_index(self, row_index: Option<RowIndex>) -> CsvReadOptions
pub fn with_row_index(self, row_index: Option<RowIndex>) -> CsvReadOptions
Adds a row index column.
Sourcepub fn with_columns(self, columns: Option<Arc<[PlSmallStr]>>) -> CsvReadOptions
pub fn with_columns(self, columns: Option<Arc<[PlSmallStr]>>) -> CsvReadOptions
Which columns to select.
Sourcepub fn with_projection(
self,
projection: Option<Arc<Vec<usize>>>,
) -> CsvReadOptions
pub fn with_projection( self, projection: Option<Arc<Vec<usize>>>, ) -> CsvReadOptions
Which columns to select denoted by their index. The index starts from 0 (i.e. [0, 4] would select the 1st and 5th column).
Sourcepub fn with_schema(
self,
schema: Option<Arc<Schema<DataType>>>,
) -> CsvReadOptions
pub fn with_schema( self, schema: Option<Arc<Schema<DataType>>>, ) -> CsvReadOptions
Set the schema to use for CSV file. The length of the schema must match the number of columns in the file. If this is None, the schema is inferred from the file.
Sourcepub fn with_schema_overwrite(
self,
schema_overwrite: Option<Arc<Schema<DataType>>>,
) -> CsvReadOptions
pub fn with_schema_overwrite( self, schema_overwrite: Option<Arc<Schema<DataType>>>, ) -> CsvReadOptions
Overwrites the data types in the schema by column name.
Sourcepub fn with_dtype_overwrite(
self,
dtype_overwrite: Option<Arc<Vec<DataType>>>,
) -> CsvReadOptions
pub fn with_dtype_overwrite( self, dtype_overwrite: Option<Arc<Vec<DataType>>>, ) -> CsvReadOptions
Overwrite the dtypes in the schema in the order of the slice that’s given. This is useful if you don’t know the column names beforehand
Sourcepub fn with_parse_options(
self,
parse_options: CsvParseOptions,
) -> CsvReadOptions
pub fn with_parse_options( self, parse_options: CsvParseOptions, ) -> CsvReadOptions
Sets the CSV parsing options. See map_parse_options for an easier way to mutate them in-place.
Sourcepub fn with_has_header(self, has_header: bool) -> CsvReadOptions
pub fn with_has_header(self, has_header: bool) -> CsvReadOptions
Sets whether the CSV file has a header row.
Sourcepub fn with_chunk_size(self, chunk_size: usize) -> CsvReadOptions
pub fn with_chunk_size(self, chunk_size: usize) -> CsvReadOptions
Sets the chunk size used by the parser. This influences performance.
Sourcepub fn with_skip_rows(self, skip_rows: usize) -> CsvReadOptions
pub fn with_skip_rows(self, skip_rows: usize) -> CsvReadOptions
Number of rows to skip before the header row.
Sourcepub fn with_skip_rows_after_header(
self,
skip_rows_after_header: usize,
) -> CsvReadOptions
pub fn with_skip_rows_after_header( self, skip_rows_after_header: usize, ) -> CsvReadOptions
Number of rows to skip after the header row.
Sourcepub fn with_infer_schema_length(
self,
infer_schema_length: Option<usize>,
) -> CsvReadOptions
pub fn with_infer_schema_length( self, infer_schema_length: Option<usize>, ) -> CsvReadOptions
Number of rows to use for schema inference. Pass None to use all rows.
Sourcepub fn with_raise_if_empty(self, raise_if_empty: bool) -> CsvReadOptions
pub fn with_raise_if_empty(self, raise_if_empty: bool) -> CsvReadOptions
Whether to raise an error if the frame is empty. By default an empty DataFrame is returned.
Sourcepub fn with_ignore_errors(self, ignore_errors: bool) -> CsvReadOptions
pub fn with_ignore_errors(self, ignore_errors: bool) -> CsvReadOptions
Continue with next batch when a ParserError is encountered.
Sourcepub fn map_parse_options<F>(self, map_func: F) -> CsvReadOptions
pub fn map_parse_options<F>(self, map_func: F) -> CsvReadOptions
Apply a function to the parse options.
Source§impl CsvReadOptions
impl CsvReadOptions
Sourcepub fn try_into_reader_with_file_path(
self,
path: Option<PathBuf>,
) -> Result<CsvReader<File>, PolarsError>
pub fn try_into_reader_with_file_path( self, path: Option<PathBuf>, ) -> Result<CsvReader<File>, PolarsError>
Creates a CSV reader using a file path.
§Panics
If both self.path and the path parameter are non-null. Only one of them is to be non-null.
Sourcepub fn into_reader_with_file_handle<R>(self, reader: R) -> CsvReader<R>where
R: MmapBytesReader,
pub fn into_reader_with_file_handle<R>(self, reader: R) -> CsvReader<R>where
R: MmapBytesReader,
Creates a CSV reader using a file handle.
Source§impl CsvReadOptions
impl CsvReadOptions
Sourcepub fn update_with_inference_result(
&mut self,
si_result: &SchemaInferenceResult,
)
pub fn update_with_inference_result( &mut self, si_result: &SchemaInferenceResult, )
Note: This does not update the schema from the inference result.
Trait Implementations§
Source§impl Clone for CsvReadOptions
impl Clone for CsvReadOptions
Source§fn clone(&self) -> CsvReadOptions
fn clone(&self) -> CsvReadOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CsvReadOptions
impl Debug for CsvReadOptions
Source§impl Default for CsvReadOptions
impl Default for CsvReadOptions
Source§fn default() -> CsvReadOptions
fn default() -> CsvReadOptions
Source§impl<'de> Deserialize<'de> for CsvReadOptions
impl<'de> Deserialize<'de> for CsvReadOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CsvReadOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CsvReadOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for CsvReadOptions
impl Hash for CsvReadOptions
Source§impl PartialEq for CsvReadOptions
impl PartialEq for CsvReadOptions
Source§impl Serialize for CsvReadOptions
impl Serialize for CsvReadOptions
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for CsvReadOptions
impl StructuralPartialEq for CsvReadOptions
Auto Trait Implementations§
impl Freeze for CsvReadOptions
impl !RefUnwindSafe for CsvReadOptions
impl Send for CsvReadOptions
impl Sync for CsvReadOptions
impl Unpin for CsvReadOptions
impl !UnwindSafe for CsvReadOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> ⓘ
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> ⓘ
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