pub struct CsvParser { /* private fields */ }Expand description
CSV parser configuration and entry point.
use u_insight::csv_parser::CsvParser;
let csv = "a,b\n1,2\n3,4\n";
let df = CsvParser::new().parse_str(csv).unwrap();
assert_eq!(df.row_count(), 2);Implementations§
Source§impl CsvParser
impl CsvParser
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a parser with default settings (comma delimiter, header row, standard null markers).
Sourcepub fn has_header(self, header: bool) -> Self
pub fn has_header(self, header: bool) -> Self
Sets whether the first row is a header (default: true).
Sourcepub fn null_markers(self, markers: Vec<String>) -> Self
pub fn null_markers(self, markers: Vec<String>) -> Self
Sets custom null markers (replaces defaults).
Sourcepub fn parse_str(&self, input: &str) -> Result<DataFrame, InsightError>
pub fn parse_str(&self, input: &str) -> Result<DataFrame, InsightError>
Parses a CSV string into a DataFrame.
Sourcepub fn parse_file(&self, path: &str) -> Result<DataFrame, InsightError>
pub fn parse_file(&self, path: &str) -> Result<DataFrame, InsightError>
Parses a CSV file from disk into a DataFrame.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CsvParser
impl RefUnwindSafe for CsvParser
impl Send for CsvParser
impl Sync for CsvParser
impl Unpin for CsvParser
impl UnsafeUnpin for CsvParser
impl UnwindSafe for CsvParser
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