pub struct Reader { /* private fields */ }Expand description
DataFrame reading struct
§Example
use blackjack::prelude::*;
let path = format!("{}/tests/data/basic_csv.csv", env!("CARGO_MANIFEST_DIR"));
let df = Reader::new(&path).delimiter(b',').read().unwrap();
let col1: &Series<f32> = df.get_column("col1").unwrap();
assert_eq!(col1.sum() as i32, 15);
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn new<S: AsRef<OsStr> + ToString>(path: &S) -> Self
pub fn new<S: AsRef<OsStr> + ToString>(path: &S) -> Self
Create a new instance of Reader with defaults CSV params
Sourcepub fn headers(self, header: Vec<String>) -> Self
pub fn headers(self, header: Vec<String>) -> Self
Set header, must be set if has_headers is false, and ignore if it is true
Sourcepub fn has_headers(self, yes: bool) -> Self
pub fn has_headers(self, yes: bool) -> Self
Whether to expect headers in the file or not.
Sourcepub fn delimiter(self, delimiter: u8) -> Self
pub fn delimiter(self, delimiter: u8) -> Self
Set the CSV delimiter, default is b',' (comma delimited)
Sourcepub fn terminator(self, terminator: u8) -> Self
pub fn terminator(self, terminator: u8) -> Self
Set the CSV line terminator, default treats any of \r, \n or \r\n as a line terminator
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reader
impl RefUnwindSafe for Reader
impl Send for Reader
impl Sync for Reader
impl Unpin for Reader
impl UnwindSafe for Reader
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> 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