Gerald Bauer
2018-08-22 16:22:10 UTC
Hello,
I’ve written up an article titled “Why the CSV standard library is
broken, broken, broken (and how to fix it)” [1].
Why not let’s make ruby the best it can be for data wrangling -
starting with the humble comma-separated values (CSV) format - the
world’s most popular data interchange format in text :-).
Try it yourself. Example:
require 'csv'
require 'pp'
begin
CSV.parse( %{1, "2"})
rescue CSV::MalformedCSVError => ex
pp ex
end
# => #<CSV::MalformedCSVError: Illegal quoting in line 1.>
begin
CSV.parse( %{"3" , 4})
rescue CSV::MalformedCSVError => ex
pp ex
end
# => #<CSV::MalformedCSVError: Unclosed quoted field on line 1.>
pp CSV.parse( %{"","",,} )
# => ["", "", nil, nil]
Is that what you expected? Questions and comments welcome. Cheers. Prost.
[1] https://github.com/csv11/docs/blob/master/why-the-csv-stdlib-is-broken.md
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby
I’ve written up an article titled “Why the CSV standard library is
broken, broken, broken (and how to fix it)” [1].
Why not let’s make ruby the best it can be for data wrangling -
starting with the humble comma-separated values (CSV) format - the
world’s most popular data interchange format in text :-).
Try it yourself. Example:
require 'csv'
require 'pp'
begin
CSV.parse( %{1, "2"})
rescue CSV::MalformedCSVError => ex
pp ex
end
# => #<CSV::MalformedCSVError: Illegal quoting in line 1.>
begin
CSV.parse( %{"3" , 4})
rescue CSV::MalformedCSVError => ex
pp ex
end
# => #<CSV::MalformedCSVError: Unclosed quoted field on line 1.>
pp CSV.parse( %{"","",,} )
# => ["", "", nil, nil]
Is that what you expected? Questions and comments welcome. Cheers. Prost.
[1] https://github.com/csv11/docs/blob/master/why-the-csv-stdlib-is-broken.md
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby