Skip to content

Instantly share code, notes, and snippets.

@deathwishdave
Last active October 9, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deathwishdave/a80dbada482a3533995d46829174aa6a to your computer and use it in GitHub Desktop.
Save deathwishdave/a80dbada482a3533995d46829174aa6a to your computer and use it in GitHub Desktop.
require 'csv'
data = CSV.parse(File.read('rooms.csv'))
groups = Hash.new(0)
data.flatten!
data.each_index do |i|
data.each_index do |j|
if data[i] = data[j]
if groups.has_key?(data[i])
groups[data[i]] += 1
else
groups[data[i]] = 1
end
end
end
end
puts groups. inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment