Reputation: 13
how to create a Polars Series from Vec<u8> in rust?
use polars::prelude::*;
fn main() {
let mut col1: Vec<u8> = Vec::new();
col1.push(1);
col1.push(2);
let s1 = Series::new("col1", col1); // error: the trait `polars::prelude::NamedFrom<Vec<u8>, _>` is not implemented for `polars::prelude::Series`
}
Upvotes: 1
Views: 644
Reputation: 27249
Yes, your code works if you enable the dtype-u8
feature like this in Cargo.toml
:
polars = { version = "0.26.1", features = ["dtype-u8"] }
The requirement was well hidden in the source code though.
Upvotes: 4