Created
September 24, 2012 11:40
-
-
Save mulderp/3775577 to your computer and use it in GitHub Desktop.
trying to do some data cleaning on JS framework survey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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