You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In readdlm (and readcsv), the quotes option allows for columns that are enclosed within double-quote (”) characters to contain new lines and column delimiters. But if there is a space before/after the delimiter, then readdlm either errors (unexpected character ' ' after quoted field) or doesn't parse the file as intended (number of rows is wrong), respectively:
a,b
c,"d, e"
results in a 2×2 Array{String,2}, good!
a,b
c, "d, e"
results in a 2×3 Array{String,2}, bad...
Because csv files are human-readable and humans usually put a space after a comma, maybe readdlm (or at least readcsv) should ignore spaces around delimiters?
The text was updated successfully, but these errors were encountered:
I think the behavior is normal for Strings: readdlm(IOBuffer("a,b"), ',') != readdlm(IOBuffer("a, b"), ',')
(even both are 1×2 Array{Any,2}: "b" != " b"
and therfore: readdlm(IOBuffer("\"a,b\""), ',') gives 1×1 Array{Any,2}: "a,b" readdlm(IOBuffer(" \"a,b\""), ',') gives 1×2 Array{Any,2}: " "a" "b""
The Error case is this: readdlm(IOBuffer("\"a,b\" "), ',') unexpected character ' ' after quoted field at row 1 column 1
In
readdlm
(andreadcsv
), the quotes option allows for columns that are enclosed within double-quote (”) characters to contain new lines and column delimiters. But if there is a space before/after the delimiter, thenreaddlm
either errors (unexpected character ' ' after quoted field
) or doesn't parse the file as intended (number of rows is wrong), respectively:results in a
2×2 Array{String,2}
, good!results in a
2×3 Array{String,2}
, bad...Because csv files are human-readable and humans usually put a space after a comma, maybe
readdlm
(or at leastreadcsv
) should ignore spaces around delimiters?The text was updated successfully, but these errors were encountered: