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

DateTime panic when using ndjson #977

Closed maennchen closed 2 months ago

maennchen commented 2 months ago

Code

[%{now: DateTime.utc_now()}]
|> Explorer.DataFrame.new()
|> Explorer.DataFrame.dump_ndjson!()

Expected

{"now":"2024-09-03T12:33:15.363536Z"}

or

{"now":"2024-09-03T12:33:15.363536+0000"}

Actual

thread '<unnamed>' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/polars-json-0.41.3/src/json/write/serialize.rs:399:13:
Invalid Offset format (must be [-]00:00) or timezones feature not active
                                                                                                                                                                                                                               note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
** (ErlangError) Erlang error: :nif_panicked
    (explorer 0.9.0) Explorer.PolarsBackend.Native.df_dump_ndjson(%Explorer.PolarsBackend.DataFrame{resource: #Reference<0.3392604668.3009806337.151230>})
    (explorer 0.9.0) lib/explorer/polars_backend/data_frame.ex:273: Explorer.PolarsBackend.DataFrame.dump_ndjson/1
    (explorer 0.9.0) lib/explorer/data_frame.ex:1542: Explorer.DataFrame.dump_ndjson!/1
    iex:6: (file)

When using any other dump function (I tried CSV, Arrow and Parquet), it works as expected.

Runtime