Skip to content

Instantly share code, notes, and snippets.

@mulderp mulderp/gist:3775577
Created Sep 24, 2012

Embed
What would you like to do?
trying to do some data cleaning on JS framework survey
f = File.open("./Mini-SurveyWhatMVFrameworkDoYouUseAndWhy.csv")
framework_pros = {"Angular" => [], "Backbone" => [], "Ember" => []}
framework_cons = {"Angular" => [], "Backbone" => [], "Ember" => []}
f.readlines.each do |l|
row = l.split(";")
if row[0].match(/Angu|angu/)
framework_pros["Angular"] << row[1]
framework_cons["Angular"] << row[2]
elsif row[0].match(/Back/)
framework_pros["Backbone"] << row[1]
framework_cons["Backbone"] << row[2]
elsif row[0].match(/Emb/)
framework_pros["Ember"] << row[1]
framework_cons["Ember"] << row[2]
elsif row[0].match(/Emb/)
framework_pros["Ember"] << row[1]
framework_cons["Ember"] << row[2]
else
framework_pros["Other: #{row[0]}"] << row[1] if framework_pros["Other: #{row[0]}"]
framework_pros["Other: #{row[0]}"] = [ row[1] ] if framework_pros["Other: #{row[0]}"].nil?
framework_cons["Other: #{row[0]}"] << row[2] if framework_cons["Other: #{row[0]}"]
framework_cons["Other: #{row[0]}"] = [ row[2] ] if framework_cons["Other: #{row[0]}"].nil?
end
end
framework_pros.each do |framework, comments|
puts "- Framework: #{framework}"
puts
puts " ++++ Why would you recommend this framework to other developers?"
puts
framework_pros[framework].each do |comment|
puts " - #{comment}".strip
end
puts " ---- What (if anything) don't you like about the framework or what would you improve?"
framework_cons[framework].each do |comment|
puts " - #{comment}".strip
end
puts
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.