I use Rust polars for analyzing time-series data. This csv data includes a lot of sensors' output, and some sensors are mostly 0 and otherwise float. Default inference schema judge such colmuns as i64, but I want to judge columns as f64.
Current Solutions are as follows, but they have some problems.
with_infer_schema_length(None)
This function scan all values and judge datatype, but become too slow.with_schema()
orwith_dtype_overwrite()
These function specify column dtype, but we should list up columns. (ex:get_column_names()
) If string columns are mixed, I should exclude them manually.
Do you know any way to enforce polars to use f64 for number columns? I want to keep str columns as it, and to convert number(i64,i32,...) columns into f64.
Thank you.
I checked official document, and found with_infer_schema_length(None)
, with_schema()
, with_dtype_overwrite()
.
However, these functions are not enough for this problem.