elixir-explorer / explorer

Series (one-dimensional) and dataframes (two-dimensional) for fast and elegant data exploration in Elixir
https://hexdocs.pm/explorer
MIT License
1.13k stars 123 forks source link

Support Elixir built in Duration struct #908

Open josevalim opened 6 months ago

josevalim commented 6 months ago

It will have loss of precision similar to other Calendar types when converted back but one can always cast to integer before/after for full precision. We should also raise if the duration has month or year set.

We need to wait until v1.17.

billylanchantin commented 6 months ago

@josevalim This would be great!

I was actually looking into a similar thing the other day. Polars supports calendar math:

This differs from pl.col("foo") + timedelta in that it can take months and leap years into account.

Our %Explorer.Duration{} is equivalent to Python's timedelta. We may want to consider adding offset_by support when we add Elixir's Duration if it supports calendar math too.