I try to add array column to the existing data-frame. input is something like this
| 1 | 3 |
| 2 | 4 |
and output is
| 1 | 3 | [?, ?, ?, ?] |
| 2 | 4 | [?, ?, ?, ?] |
value of the array will be populated by some custom function.
I try to implement something like this.
let df = df![
"a" => [1, 2],
"b" => [3, 4]
]?;
let lf: LazyFrame = df.lazy().select(
as_struct(&[col("a"), col("b")]).apply(
somefn,
GetOutput::from_type(DataType::List(Box::new(DataType::Float32))),
));
I don't know how to implement this somefn
.