polars_io::csv::read::schema_inference

Function infer_file_schema

Source
pub fn infer_file_schema(
    reader_bytes: &ReaderBytes<'_>,
    parse_options: &CsvParseOptions,
    max_read_rows: Option<usize>,
    has_header: bool,
    schema_overwrite: Option<&Schema>,
    skip_rows: usize,
    skip_lines: usize,
    skip_rows_after_header: usize,
    raise_if_empty: bool,
    n_threads: &mut Option<usize>,
) -> PolarsResult<(Schema, usize, usize)>
Available on crate features csv or json only.
Expand description

Infer the schema of a CSV file by reading through the first n rows of the file, with max_read_rows controlling the maximum number of rows to read.

If max_read_rows is not set, the whole file is read to infer its schema.

Returns - inferred schema - number of rows used for inference. - bytes read