SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.04k stars 140 forks source link

Daru::DataFrame.from_csv ArgumentError: wrong number of arguments (given 2, expected 1) #543

Open raghuvaranreddy opened 2 years ago

raghuvaranreddy commented 2 years ago

Seeing below error when using from_csv after upgrading ruby to 3.0.3 Failure/Error: Daru::DataFrame.from_csv( mock_data, index: index, converters: ->(c) { c.to_d unless c.nil? }, headers: true, header_converters: header_converters )

 ArgumentError:
   wrong number of arguments (given 2, expected 1)

.rvm/gems/ruby-3.0.3/gems/daru-0.3/lib/daru/io/io.rb:234:in `from_csv_hash_with_headers'

https://github.com/SciRuby/daru/blob/3ac3d15f3c1b2e7f5a00b61e6cc81c652d4d0250/lib/daru/io/io.rb#L234

My guess or thought is at line 234 .parse(open(path), opts) should be .parse(open(path), **opts)

similar to parse in below. https://github.com/SciRuby/daru/blob/3ac3d15f3c1b2e7f5a00b61e6cc81c652d4d0250/lib/daru/io/io.rb#L242

because the way we pass args has changed upto my understanding in 3.0

Resolution: Changing line 234 .parse(open(path), opts) should be .parse(open(path), **opts) Resolved the issues locally