I'm facing with problem using Rust
for converting Polars DataFrame
with string values into ndarray
without One Hot Encoding.
The example of code I used is the following:
println!("{:?}", _df.to_ndarray::<Float64Type>(Default::default()).unwrap());
Is there any solution for that?
I think you can use the
apply
method and iterate over each column in the DataFrame and convert it to a numeric representation.so the resulting DataFrame,df_numeric
, will have numeric values instead of strings and finally use theto_ndarray
method to convert the DataFrame to an ndarray, and the resulting ndarray,ndarray
, will haveOption
type to handle missing values.