I have use Polars in my Cargo.toml like this:
polars = { version = "0.24.3", features = ["lazy", "temporal", "ipc", "ipc_streaming", "dtype-datetime"] }
I have a Series extracted from a DataFrame that has datetime[ns] without a timezone. I now would like to convert this data into chrono objects, but I am not sure how. This is what I tried:
c.iter().for_each(|r| {
let c: chrono::DateTime<chrono::Utc> = r.into();
});
Unfortunately, the compiler says this does not work - and none of the other implementations seem useful to me:
error[E0277]: the trait bound `polars::export::chrono::DateTime<Utc>: From<polars::prelude::AnyValue<'_>>` is not satisfied
--> src/main.rs:21:46
|
21 | let c: chrono::DateTime<chrono::Utc> = r.into();
| ^^^^ the trait `From<polars::prelude::AnyValue<'_>>` is not implemented for `polars::export::chrono::DateTime<Utc>`
|
= help: the following other types implement trait `From<T>`:
<polars::export::chrono::DateTime<FixedOffset> as From<polars::export::chrono::DateTime<Local>>>
<polars::export::chrono::DateTime<FixedOffset> as From<polars::export::chrono::DateTime<Utc>>>
<polars::export::chrono::DateTime<Local> as From<SystemTime>>
<polars::export::chrono::DateTime<Local> as From<polars::export::chrono::DateTime<FixedOffset>>>
<polars::export::chrono::DateTime<Local> as From<polars::export::chrono::DateTime<Utc>>>
<polars::export::chrono::DateTime<Utc> as From<SystemTime>>
<polars::export::chrono::DateTime<Utc> as From<polars::export::chrono::DateTime<FixedOffset>>>
<polars::export::chrono::DateTime<Utc> as From<polars::export::chrono::DateTime<Local>>>
= note: required because of the requirements on the impl of `Into<polars::export::chrono::DateTime<Utc>>` for `polars::prelude::AnyValue<'_>````