pub struct CsvReader { /* private fields */ }Expand description
A CSV file reader with configurable parsing options.
Uses a fluent builder pattern: construct with CsvReader::new, chain
optional configuration methods, then call CsvReader::finish to load
the data into a DataFrame.
§Example
use plotlars_core::io::CsvReader;
let df = CsvReader::new("data/penguins.csv")
.has_header(true)
.try_parse_dates(true)
.finish()
.unwrap();Implementations§
Source§impl CsvReader
impl CsvReader
Sourcepub fn has_header(self, has_header: bool) -> Self
pub fn has_header(self, has_header: bool) -> Self
Set whether the first row is a header row. Defaults to true.
Sourcepub fn skip_rows(self, skip_rows: usize) -> Self
pub fn skip_rows(self, skip_rows: usize) -> Self
Set the number of rows to skip before reading data.
Sourcepub fn null_values(self, null_values: Vec<&str>) -> Self
pub fn null_values(self, null_values: Vec<&str>) -> Self
Set strings that should be interpreted as null values.
Sourcepub fn try_parse_dates(self, try_parse_dates: bool) -> Self
pub fn try_parse_dates(self, try_parse_dates: bool) -> Self
Attempt to automatically parse date and datetime columns.
Sourcepub fn finish(self) -> Result<DataFrame, PlotlarsError>
pub fn finish(self) -> Result<DataFrame, PlotlarsError>
Execute the read and return a DataFrame.
§Errors
Returns PlotlarsError::Io if the file cannot be opened, or
PlotlarsError::CsvParse if the CSV data cannot be parsed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CsvReader
impl RefUnwindSafe for CsvReader
impl Send for CsvReader
impl Sync for CsvReader
impl Unpin for CsvReader
impl UnsafeUnpin for CsvReader
impl UnwindSafe for CsvReader
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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