parsing gets wrong if first line begins with a comma
See original GitHub issueJust check the following:
papa.parse(',"a","b"\n,,"c","d,e",,34,')
The delimiter is the comma, this is OK. But the parsed first line includes just one column that encompasses the whole string ',"a","b"'
The problem seems to happen with the first line only, leading commas in subsequent lines make no hassle.
In the program where I use papaparse, I fixed this problem by adding a leading ""
if the string starts with a comma, hence I get
papa.parse('"","a","b"\n,,"c","d,e",,34,')
which works OK
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
awk not parsing the first line of file - Stack Overflow
The first line is not comma separated so it is ignored in the sense that the awk command isn't being applied. – antimuon....
Read more >Parsing Text with PowerShell (1/3) - Microsoft Developer Blogs
A task that appears regularly in my workflow is text parsing. It may be about getting a token from a single line of...
Read more >pandas.read_table — pandas 1.5.2 documentation
Lines with too many fields (e.g. a csv line with too many commas) will by default cause an exception to be raised, and...
Read more >How to Parse a CSV File in Bash? - Shell Tips!
Learn how to parse a CSV file in Bash and avoid the common pitfalls. Includes examples using bash builtins and the awk command...
Read more >Bash Read Comma Separated CSV File on Linux / Unix
IFS variable will set cvs separated to , (comma). The read command will read each line and store data into each field. Let...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah i get the same issue. is there any workaround ?
I tripped across this bug today. This note is to add another test case: it occurs on any row starting with the delimiter. Eg with
header: true
:OK:
error:
error:
error:
The header row always gets correctly parsed. The error is all the same, a variant of: