Skip to content

Instantly share code, notes, and snippets.

@correlator
Last active August 29, 2015 13:57
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 correlator/9633880 to your computer and use it in GitHub Desktop.
Save correlator/9633880 to your computer and use it in GitHub Desktop.
script to pull down unique counts
states.each do |state|
csv = CSV.open("/mnt/nbec_voterdata/scott/match_stats/#{state.downcase}/county_zip5_birthdate_initials", 'wb')
table = MasterVoter.on(state)
totals = table.where({ is_dropped_from_file: false }).count(group: ['county', 'residential_zip5', 'born_at', "CONCAT(LEFT(first_name, 1), LEFT(last_name, 1))"])
totals.values.each { |v| csv << [v] }
csv.close()
totals = nil
GC.start()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment