Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If CSV has encoding problem, Polars loads a dataset with zero rows #1976

Open
mccalluc opened this issue Aug 23, 2024 · 4 comments
Open

If CSV has encoding problem, Polars loads a dataset with zero rows #1976

mccalluc opened this issue Aug 23, 2024 · 4 comments

Comments

@mccalluc
Copy link
Contributor

Hit this during the hackathon, and it was confusing. It's not really our problem... but with DP people aren't supposed to look at the data, so maybe we need to work harder to parse the CSV than polars out of the box, which assumes user interaction.

@Shoeboxam
Copy link
Member

The behavior I'm seeing with your xfail example is that it parses any rows with unusual characters (like é) as null. Values without those characters parse correctly.

mccalluc added a commit that referenced this issue Aug 28, 2024
- Towards #1976

If we decide to implement a friendlier CSV loader, we can test it here.
@mccalluc
Copy link
Contributor Author

I thought I saw in the hackathon that no rows would load if there was a misencoding anywhere. I can expand the test.

@SalilVadhan
Copy link

SalilVadhan commented Aug 28, 2024 via email

@mccalluc
Copy link
Contributor Author

mccalluc commented Oct 2, 2024

Solution proposed in

is to use encoding="utf8-lossy": It's not perfect, but unless two grouping strings are identical apart from characters that are misencoded, it wouldn't harm the statistics. Somehow getting the correct encoding and re-encoding the CSV feels like a big hassle for very little gain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants