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.12k stars 123 forks source link

Exporting to CSV with a duration column returns an error #901

Closed billylanchantin closed 2 months ago

billylanchantin commented 7 months ago

Example

require Explorer.DataFrame, as: DF

one_ms = %Explorer.Duration{value: 1, precision: :millisecond}

DF.new(duration: [one_ms])
|> DF.to_csv("output.csv")
# {:error, %RuntimeError{message: "Polars Error: datatype 1ms cannot be written to csv"}}

Thoughts

This isn't a "bug" as much as a gotcha since it's not documented anywhere. I think we should call this behavior out somewhere, perhaps in to_csv?

Related issues