How to read all columns as string with polars at rust? That's my code
let df = CsvReader::from_path(filecsv)?.has_header(true).finish()?; Ok(df)
It read some data as int64, but I want to read all columns (whenever they're calls) as string. How can I do it?
Here is my solution,it can only convert some(not all) fields to
strand you need to add thesmartstringcrate.=================================================
After further experimentation, I find another way. This requires using the
csvcrate. First, you need read theCSV headersusingrdr.headers()and map them into an iterator. Then, a schema is created by usingfrom_iter.The drawback of this approach is that it requires reading the file twice, which can be inefficient. Unfortunately, I haven't found a suitable API to avoid this limitation at the moment.
Maybe there are better solutions...?