pyarrow: open_csv with an empty file #46429
Unanswered
delucchi-cmu
asked this question in
Q&A
Replies: 1 comment
-
You can always wrap it in try except. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some CSV files with header lines, and some may not contain any data rows. I'm struggling to find the right options to read such files using
open_csv
and have this return either an emptyTable
orNone
.Such a file might be:
Some examples of patterns I've tried, and the errors I get:
yields
ArrowInvalid: CSV parse error: Empty CSV file or block: cannot infer number of columns
yields
Could not skip initial 1 rows from CSV file, either file is too short or header is larger than block size
.Is there a way to have
pyarrow.open_csv
open my (mostly) empty file, and not raise an error?Beta Was this translation helpful? Give feedback.
All reactions