Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

allow symbol to converters option #445

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/daru/io/io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def from_csv_prepare_opts opts
end

def from_csv_prepare_converters(converters)
converters.flat_map do |c|
Array(converters).flat_map do |c|
if ::CSV::Converters[c]
::CSV::Converters[c]
elsif Daru::IO::CSV::CONVERTERS[c]
Expand Down
5 changes: 5 additions & 0 deletions spec/io/io_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
expect(df['Domestic'].to_a).to all be_boolean
end

it "allow symbol to converters option" do
df = Daru::DataFrame.from_csv 'spec/fixtures/boolean_converter_test.csv', converters: :boolean
expect(df['Domestic'].to_a).to all be_boolean
end

it "checks for equal parsing of local CSV files and remote CSV files" do
%w[matrix_test repeated_fields scientific_notation sales-funnel].each do |file|
df_local = Daru::DataFrame.from_csv("spec/fixtures/#{file}.csv")
Expand Down