Quantcast
Channel: Using csv data to create a hash of each occurance of a value in Ruby
Browsing all 4 articles
Browse latest View live

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 Article



Using 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 Article

Using 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 Article

Using 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
Browsing all 4 articles
Browse latest View live


Latest Images