-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
The code below is trying to apply the conversion before writing to the buffer to respond. It does not apply any dtype change to the column.
I tryed multiple ways but the lack of documentation and access to low level in polars limits this possibility of conversion.
use polars::prelude::*;
// Converting from LargeUtf8 to Utf8
let col_names = df.get_column_names_owned();
for (index, name) in col_names.iter().enumerate() {
let col = df.column(&name).unwrap();
if col.dtype() == &ArrowDataType::LargeUtf8 {
let new_col = &col.strict_cast(&DataType::from_arrow(&ArrowDataType::Utf8, true))?;
//let new_col = col.u8().unwrap();
df.replace_column(index, new_col.to_owned().into_series()).unwrap();
}
}
// Checking if anything changed
for (index, name) in col_names.iter().enumerate() {
let col = df.column(&name).unwrap();
if col.dtype() == &ArrowDataType::LargeUtf8 {
println!("Column in LargeUtf8 {:?}", name);
}
}Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status