Skip to main content

Module read

Module read 

Source
Available on crate features csv or json only.
Expand description

Functionality for reading CSV files.

§Examples

use polars_core::prelude::*;
use polars_io::prelude::*;
use std::fs::File;

fn example() -> PolarsResult<DataFrame> {
    // Prefer `from_path` over `new` as it is faster.
    CsvReadOptions::default()
        .with_has_header(true)
        .try_into_reader_with_file_path(Some("example.csv".into()))?
        .finish()
}

Re-exports§

pub use streaming::read_until_start_and_infer_schema_from_compressed_reader;

Modules§

_csv_read_internal
builder
schema_inference
streaming

Structs§

CsvParseOptions
CsvReadOptions
CsvReader
Create a new DataFrame by reading a csv file.
SplitLines
An adapted version of std::iter::Split. This exists solely because we cannot split the file in lines naively as

Enums§

CommentPrefix
CsvEncoding
NullValues

Functions§

complete_rows_len
Returns the length of the longest prefix of bytes that only holds complete rows, i.e. up to and including the last eol_char outside of a quoted field. Like skip_lines itself, the first skip_lines lines are split without regard to quoting. Like the CSV reader, a UTF-8 BOM after them is skipped, so that a comment prefix on the next line is found.
count_rows
Read the number of rows without parsing columns useful for count(*) queries
count_rows_from_reader_par
Read the number of rows without parsing columns. Useful for count(*) queries. Supports transparent decompression. Does not support truncated compressed files.
count_rows_from_slice_par
Read the number of rows without parsing columns. Useful for count(*) queries. Supports transparent decompression.