Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jay-johnson/23e8ac8a8a575c76eeb04a4c6c6a7bb7 to your computer and use it in GitHub Desktop.
Save jay-johnson/23e8ac8a8a575c76eeb04a4c6c6a7bb7 to your computer and use it in GitHub Desktop.
Polars Rust - Convert DataFrame Epoch Column in Milliseconds (i64) to a UTC date-formatted string
let date_utc_str_s: Series = Series::new(
"date_utc_str",
df
.column("date")
.unwrap()
.cast(&DataType::Datetime(
polars::datatypes::TimeUnit::Milliseconds,
None))
.unwrap()
.strftime("%Y-%m-%dT%H:%M:%SZ")
.unwrap());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment