Skip to content

Instantly share code, notes, and snippets.

Created February 1, 2013 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4692779 to your computer and use it in GitHub Desktop.
Save anonymous/4692779 to your computer and use it in GitHub Desktop.
Messing around with categories from the House floor bulk data at http://clerk.house.gov/floorsummary/floor-download.aspx
irb(main):002:0> cs = FloorUpdate.where(year: 2012).distinct(:category); cs.size
=> 80
irb(main):003:0> cs
=> ["H21000", "H60100", "H8D000", "H38310", "H23210", "H37100", "H30000", "H2A100", "H20100", "H61000", "H2C000", "H60000", "H25100", "H37300", "H26200", "H41400", "H40150", "H36100", "H35000", "H32111", "H32400", "H32020", "H41931", "H41610", "H23100", "H24900", "H22000", "H37220", "H30300", "H24100", "H24500", "H36110", "H8A000", "H34400", "H32600", "H32140", "H3A100", "H29400", "H32700", "H32341", "H32340", "H24200", "H29800", "H32050", "H24400", "H32500", "H32130", "H37210", "H40140", "H25200", "H26300", "H36710", "H36700", "H30200", "H42510", "H40210", "H32311", "H32310", "H40200", "H36510", "H36500", "H24800", "H27200", "H38900", "H40110", "H38800", "H34111", "H34180", "H34140", "H1B000", "H24600", "H36610", "H28900", "H40142", "H30520", "H30500", "H41800", "H41541", "H41540", "H40141"]
irb(main):004:0> FloorUpdate.where(year: 2012, category: "H21000").count
=> 78
irb(main):005:0> cs.map {|c| FloorUpdate.where(year: 2012, category: c).count}
=> [78, 51, 1013, 283, 6, 93, 410, 1, 158, 156, 68, 51, 23, 211, 29, 8, 7, 17, 41, 181, 9, 10, 13, 15, 57, 1, 65, 49, 218, 14, 46, 17, 17, 10, 10, 8, 209, 10, 10, 10, 10, 26, 18, 10, 13, 2, 15, 48, 14, 2, 5, 1, 1, 24, 2, 2, 2, 2, 2, 1, 1, 5, 2, 1, 1, 23, 6, 4, 1, 5, 1, 1, 3, 2, 1, 2, 14, 1, 1, 8]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment