October 25, 2024
Chicago 12, Melborne City, USA
python

Error reading csv.xz file using polars in python


I have a large file ‘myfile.csv.xz’ that I want to read using the polars package. When I do pl.read_csv(myfile.csv.xz) it fails with error ComputeError: invalid utf-8 sequance. If I do pl.read_csv(myfile.csv) or pl.read_csv(lzma.open(myfile.csv.xz)), it works fine.

The encoding of the file seems to the just ascii, so a subset of utf-8 I suppose?

How do I diagnose the error and possibly fix it?



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video