alphydan
Hello,
I’m an elixir beginner, exploring livebook. I’m running a local notebook on a linux machine. Initially I tried to import a CSV file with Explorer like so:
alias Explorer.{DataFrame, Series}
path_to_csv = "./some_file.csv"
DataFrame.from_csv!(path_to_csv)
However, I am seeing the following error:
** (RuntimeError) from_csv failed: {:polars, "Could not parse `Fee Amount`
as dtype Int64 at column 16.\nThe current offset in the file is 249 bytes.\n\n
Consider specifying the correct dtype, increasing\n
the number of records used to infer the schema,\n
enabling the `ignore_errors` flag, or adding\n`Fee Amount` to the `null_values` list."}
(explorer 0.5.5) lib/explorer/data_frame.ex:438: Explorer.DataFrame.from_csv!/2
To check if the problem was indeed with the data in the column Fee Amount, I filled the column with integers. But I get the same error. What can I try to better diagnose this problem?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication):
toke...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
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
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ai
- #ecto-query
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hi @alphydan welcome! Are you able to provide a sample of that CSV file?
BradS2S
You can use :dtype to explicitly set the data type for a column instead of letting it try to infer it.
al2o3cr
One small thing that jumps out:
This sounds like it’s on at least the second line of the file, and so should be data
That’s a reference to the
with_null_valuessetting inpolars_io::csv::CsvReader, which is intended to parse values like"n/a"tonull.The message suggests that the reader found the literal string “Fee Amount” where it expected data.
alphydan
@BradS2S @benwilson512 @al2o3cr Thank you for all your suggestions. “Fee Amount” was not on the second line, but on the header (first row).
A potential problem with the header led me to try changing all headers to the format
something_or_the_otherinstead ofSomething Or \n the Other.I found that it failed when I had a return character inside the header. The CSV gets imported correctly now. Thank you for the prompt replies.
LostKobrakai
Were these quoted? If no, then that’s indeed invalid. If they were, then this sounds like a but in the csv parser.
alphydan
Ok, here’s an example to further diagnose the problem:
Running
$ cat -v example_failing.csvin the terminal shows:(Where
$corresponds to\nor Unix line endings). Trying to import it in livebook:leads to this error:
BradS2S
Remove all the new line characters from the column headers.
LostKobrakai
That sounds like a bug / missing implementation in the parser of polars then.
LForCRLFare supposed to be allowed in quoted fields based on RFC 4180.alphydan
Removing all return characters leads to an import without errors.
is imported correctly. Does that mean that return characters are not allowed in headers, even with quotes?
return characters outside the header seem to be imported correctly. for example, if I have an element of the csv be
Tiger and \nBeasts, but no returns in the header I can see:BradS2S
Yes you want it on a single line. That parsing error means they don’t expect labels to be on more than one line