evadne
Hi all
I have some issues reading nanosecond precision timestamps in CSVs using latest explorer.
Repro as follows:
./script/ingestion_test.csv
datetime_ns
1738573413286629810
./script/ingestion_test.exs
Mix.install([
:explorer
])
{options, _, _} = OptionParser.parse(System.argv(), strict: [path: :string])
{:ok, path} = Keyword.fetch(options, :path)
Explorer.DataFrame.from_csv(Path.relative_to_cwd(path), [
infer_schema_length: 0,
columns: [
"datetime_ns"
],
dtypes: [
{"datetime_ns", {:naive_datetime, :nanosecond}}
]
])
|> IO.inspect()
Outcome:
$ elixir ./script/ingestion_test.exs --path ./script/ingestion_test.csv
{:error,
%RuntimeError{
message: "Polars Error: could not parse `1738573413286629810` as dtype `datetime[ns]` at column 'datetime_ns' (column number 1)\n\nThe current offset in the file is 12 bytes.\n\nYou might want to try:\n- increasing `infer_schema_length` (e.g. `infer_schema_length=10000`),\n- specifying correct dtype with the `dtypes` argument\n- setting `ignore_errors` to `True`,\n- adding `1738573413286629810` to the `null_values` list.\n\nOriginal error: ```could not find a 'date/datetime' pattern for '1738573413286629810'```"
}}
Surely I’m missing something elementary?
https://www.unixtimestamp.com/ agrees the timestamp is good. But it won’t parse.
Many thanks in advance
elixir 1.17.2
erlang 27.0.1
explorer 0.10.1
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Other Trending Topics
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #hex










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kevinschweikert
I think Explorer only supports NaiveDatetime. I made it work with this code in Livebook:
evadne
=
billylanchantin
@evadne Glad you figured it out
FWIW I couldn’t get Polars to (which Explorer uses under the hood) to parse the timestamp directly either. So your
castapproach is what I’d use too. I will throw a few more pointers out there.DF.mutate/2is nice because you don’t need to keep around the original column:There is also the
:lazyoption. It will defer the computation so that you never create the intermediate column in the first place:That option is only needed if you need to go real fast for some reason.
Also, we do have support for non-naive datetimes. But that doesn’t seem super relevant for this use case.