Using csv data to create a hash of each occurance of a value in Ruby
I am trying to take data from a csv and create a count from the medicine column. Sample data of csv looks like: name medicine age address molly tylenol 21 1203 tyler advil 19 1008 bob tylenol 41 192...
View ArticleUsing csv data to create a hash of each occurance of a value in Ruby
When you create your Hash, you can tell it to have a default value of zero in case referenced at a key that isn’t already in there. So then when you hit a row from your table, you can just add one to...
View ArticleUsing csv data to create a hash of each occurance of a value in Ruby
Example from IRB: irb(main):002:0> it = Hash.new(0) => {} irb(main):003:0> it["izzatso"] += 1 => 1 irb(main):004:0> it => {"izzatso"=>1} Read full topic
View ArticleUsing csv data to create a hash of each occurance of a value in Ruby
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed. Read full topic
View Article