Expand description
CSV parser with automatic type inference.
Parses CSV files into a DataFrame
with column types automatically inferred from content. The inference
priority is: Numeric → Boolean → Categorical → Text.
§Features
- RFC 4180 compliant (quoted fields, escaped quotes, commas in fields)
- Automatic type inference per column
- Standard null markers recognized: empty,
NA,N/A,null,NULL,None,. - Low-cardinality strings are dictionary-encoded as Categorical
- Configurable delimiter and null markers
§Example
use u_insight::csv_parser::CsvParser;
use u_insight::dataframe::DataType;
let csv = "name,value,active\nAlice,1.5,true\nBob,2.3,false\n";
let df = CsvParser::new().parse_str(csv).unwrap();
assert_eq!(df.row_count(), 2);
assert_eq!(df.column_count(), 3);
assert_eq!(df.column(0).unwrap().data_type(), DataType::Text);
assert_eq!(df.column(1).unwrap().data_type(), DataType::Numeric);
assert_eq!(df.column(2).unwrap().data_type(), DataType::Boolean);Structs§
- CsvParser
- CSV parser configuration and entry point.