Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from collections import (
defaultdict,
OrderedDict,
)
games = [
{
'categories': ['Deduction', 'Party Game', 'Spies/Secret Agents', 'Word Game'],
'game': 'Codenames',
'id': 178900,
'votes': 9,
'weight': 1.0,
'year': 2015
},
{
'categories': ['Card Game'],
'game': '6 Nimmt!',
'id': 432,
'votes': 6,
'weight': 1.0,
'year': 1994
},
{
'categories': ['Ancient', 'Card Game', 'City Building', 'Civilization'],
'game': '7 Wonders',
'id': 68448,
'votes': 5,
'weight': 2.0,
'year': 2010
}, {
'categories': ['Civilization', 'Economic', 'Fantasy', 'Territory Building'],
'game': 'Terra Mystica',
'id': 120677,
'votes': 4,
'weight': 3.0,
'year': 2012
}, {
'categories': ['Dice', 'Medieval', 'Territory Building'],
'game': 'The Castles of Burgundy',
'id': 84876,
'votes': 4,
'weight': 3.0,
'year': 2011
}, {
'categories': ['Economic', 'Industry / Manufacturing'],
'game': 'Power Grid',
'id': 2651,
'votes': 3,
'weight': 3.0,
'year': 2004
}, {
'categories': ['Card Game', 'Comic Book / Strip', 'Fighting'],
'game': 'Sentinels of the Multiverse',
'id': 102652,
'votes': 3,
'weight': 2.0,
'year': 2011
}, {
'categories': ['Medical'],
'game': 'Pandemic',
'id': 30549,
'votes': 3,
'weight': 2.0,
'year': 2008
}, {
'categories': ['City Building', 'Fantasy'],
'game': 'Lords of Waterdeep',
'id': 110327,
'votes': 3,
'weight': 2.0,
'year': 2012
}, {
'categories': ['Card Game', 'Medieval'],
'game': 'Dominion',
'id': 36218,
'votes': 3,
'weight': 2.0,
'year': 2008
}, {
'categories': ['Adventure', 'Exploration', 'Horror', 'Miniatures'],
'game': 'Betrayal at House on the Hill',
'id': 10547,
'votes': 3,
'weight': 2.0,
'year': 2004
}, {
'categories': ['Arabian', 'Dice', 'Economic'],
'game': 'Yspahan',
'id': 22345,
'votes': 2,
'weight': 2.0,
'year': 2006
}, {
'categories': ['Ancient', 'Wargame'],
'game': 'Trajan',
'id': 741,
'votes': 2,
'weight': 3.0,
'year': 1991
}, {
'categories': ['Trains', 'Travel'],
'game': 'Ticket to Ride',
'id': 9209,
'votes': 2,
'weight': 1.0,
'year': 2004
}, {
'categories': ['Civilization', 'Economic'],
'game': 'Through the Ages: A Story of Civilization',
'id': 25613,
'votes': 2,
'weight': 4.0,
'year': 2006
}, {
'categories': ['Adventure', 'Medieval', 'Science Fiction'],
'game': 'T.I.M.E Stories',
'id': 146508,
'votes': 2,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Negotiation'],
'game': 'catan',
'id': 13,
'votes': 2,
'weight': 2.0,
'year': 1995
}, {
'categories': ['City Building', 'Economic', 'Farming'],
'game': 'Puerto Rico',
'id': 3076,
'votes': 2,
'weight': 3.0,
'year': 2002
}, {
'categories': ['Dice'],
'game': 'Las Vegas',
'id': 24588,
'votes': 2,
'weight': 0.0,
'year': 1983
}, {
'categories': ['City Building',
'Economic',
'Nautical',
'Renaissance',
'Territory Building'
],
'game': 'Keyflower',
'id': 122515,
'votes': 2,
'weight': 3.0,
'year': 2012
}, {
'categories': ['Card Game', 'Deduction', 'Memory'],
'game': 'Hanabi',
'id': 98778,
'votes': 2,
'weight': 1.0,
'year': 2010
}, {
'categories': ['Action / Dexterity', 'American West'],
'game': "Flick 'Em Up!",
'id': 169124,
'votes': 2,
'weight': 1.0,
'year': 2015
}, {
'categories': ['Arabian', 'Fantasy', 'Mythology'],
'game': 'Five Tribes',
'id': 157354,
'votes': 2,
'weight': 2.0,
'year': 2014
}, {
'categories': ['Animals', 'Environmental', 'Prehistoric'],
'game': 'Dominant Species',
'id': 62219,
'votes': 2,
'weight': 4.0,
'year': 2010
}, {
'categories': ['Medieval', 'Territory Building'],
'game': 'Carcassonne',
'id': 822,
'votes': 2,
'weight': 1.0,
'year': 2000
}, {
'categories': ['Exploration', 'Maze', 'Spies/Secret Agents'],
'game': 'Burgle Bros.',
'id': 172081,
'votes': 2,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Fantasy', 'Miniatures', 'Mythology'],
'game': 'Blood Rage',
'id': 170216,
'votes': 2,
'weight': 2.0,
'year': 2015
}, {
'categories': ['American West', 'Bluffing', 'Card Game', 'Deduction', 'Fighting'],
'game': 'Bang!',
'id': 3955,
'votes': 2,
'weight': 1.0,
'year': 2002
}, {
'categories': ['Deduction', 'Fantasy'],
'game': 'Alchemists',
'id': 161970,
'votes': 2,
'weight': 3.0,
'year': 2014
}, {
'categories': ['Civilization', 'Negotiation', 'Political', 'Science Fiction', 'Space Exploration', 'Wargame'],
'game': 'Twilight Imperium (Third Edition)',
'id': 12493,
'votes': 2,
'weight': 4.0,
'year': 2005
}, {
'categories': ['Card Game', 'Collectible Components', 'Fantasy', 'Fighting'],
'game': 'Magic: the Gathering',
'id': 463,
'votes': 2,
'weight': 3.0,
'year': 1993
}, {
'categories': ['Ancient', 'Bluffing', 'Fighting', 'Wargame'],
'game': 'Zhanguo',
'id': 33005,
'votes': 1,
'weight': 0.0,
'year': 2007
}, {
'categories': ['Abstract Strategy', 'Deduction', 'Puzzle'],
'game': 'Zendo',
'id': 6830,
'votes': 1,
'weight': 2.0,
'year': 2001
}, {
'categories': ['Card Game'],
'game': 'Yakitori',
'id': 100543,
'votes': 1,
'weight': 1.0,
'year': 2011
}, {
'categories': ['Fantasy', 'Horror', 'Novel-based'],
'game': 'Witch of Salem',
'id': 38506,
'votes': 1,
'weight': 2.0,
'year': 2008
}, {
'categories': ['Economic', 'Farming'],
'game': 'Viticulture',
'id': 128621,
'votes': 1,
'weight': 2.0,
'year': 2013
}, {
'categories': ['Racing', 'Sports'],
'game': 'TurfMaster',
'id': 384,
'votes': 1,
'weight': 1.0,
'year': 1998
}, {
'categories': ['Travel'],
'game': 'Tokaido',
'id': 123540,
'votes': 1,
'weight': 1.0,
'year': 2012
}, {
'categories': ['Humor', 'Movies / TV / Radio theme', 'Party Game'],
'game': "Time's Up! Title Recall!",
'id': 36553,
'votes': 1,
'weight': 1.0,
'year': 2008
}, {
'categories': ['Card Game'],
'game': 'Tichu',
'id': 215,
'votes': 1,
'weight': 2.0,
'year': 1991
}, {
'categories': ['Economic'],
'game': 'The Speicherstadt',
'id': 66505,
'votes': 1,
'weight': 2.0,
'year': 2010
}, {
'categories': ['Bluffing', 'Deduction', 'Negotiation', 'Party Game', 'Science Fiction', 'Spies/Secret Agents'],
'game': 'The Resistance',
'id': 41114,
'votes': 1,
'weight': 1.0,
'year': 2009
}, {
'categories': ['Economic', 'Movies / TV / Radio theme'],
'game': 'The Networks',
'id': 72321,
'votes': 1,
'weight': 2.0,
'year': 2016
}, {
'categories': ['Card Game', 'World War I'],
'game': 'The Grizzled',
'id': 171668,
'votes': 1,
'weight': 1.0,
'year': 2015
}, {
'categories': ['Card Game', 'Medieval'],
'game': 'The Great Dalmuti',
'id': 929,
'votes': 1,
'weight': 1.0,
'year': 1995
}, {
'categories': ['Economic'],
'game': 'The Gallerist',
'id': 125153,
'votes': 1,
'weight': 4.0,
'year': 2015
}, {
'categories': ['Animals', 'Environmental', 'Farming', 'Territory Building'],
'game': 'Takenoko',
'id': 70919,
'votes': 1,
'weight': 1.0,
'year': 2011
}, {
'categories': ['Adventure', 'Nautical'],
'game': 'Survive: Escape from Atlantis!',
'id': 2653,
'votes': 1,
'weight': 1.0,
'year': 1982
}, {
'categories': ['Card Game'],
'game': 'Succession',
'id': 3121,
'votes': 1,
'weight': 0.0,
'year': 1976
}, {
'categories': ['Industry / Manufacturing', 'Science Fiction'],
'game': 'Steam Works',
'id': 143176,
'votes': 1,
'weight': 3.0,
'year': 2015
}, {
'categories': ['Movies / TV / Radio theme', 'Science Fiction'],
'game': 'Star Wars: Rebellion',
'id': 187645,
'votes': 1,
'weight': 3.0,
'year': 2016
}, {
'categories': ['Fantasy', 'Fighting', 'Territory Building'],
'game': 'Small World',
'id': 40692,
'votes': 1,
'weight': 2.0,
'year': 2009
}, {
'categories': ['Bluffing', 'Card Game', 'Humor', 'Medieval', 'Negotiation', 'Novel-based'],
'game': 'Sheriff of Nottingham',
'id': 157969,
'votes': 1,
'weight': 1.0,
'year': 2014
}, {
'categories': ['Adventure', 'Deduction', 'Fantasy', 'Medieval', 'Mythology'],
'game': 'Shadows over Camelot',
'id': 15062,
'votes': 1,
'weight': 2.0,
'year': 2005
}, {
'categories': ['Card Game', 'Puzzle', 'Real-time'],
'game': 'Set',
'id': 1198,
'votes': 1,
'weight': 1.0,
'year': 1988
}, {
'categories': ['Card Game', 'Comic Book / Strip', 'Fighting'],
'game': 'Sentinels of the Multiverse',
'id': 102652,
'votes': 1,
'weight': 2.0,
'year': 2011
}, {
'categories': ['Abstract Strategy', 'Medieval'],
'game': 'Samurai',
'id': 3,
'votes': 1,
'weight': 2.0,
'year': 1998
}, {
'categories': ['Age of Reason', 'Economic'],
'game': 'Rococo',
'id': 144344,
'votes': 1,
'weight': 3.0,
'year': 2013
}, {
'categories': ['Political', 'Wargame', 'World War II'],
'game': 'Resistance',
'id': 165056,
'votes': 1,
'weight': 0.0,
'year': 2013
}, {
'categories': ['Bluffing', 'Spies/Secret Agents'],
'game': '[redacted]',
'id': 161578,
'votes': 1,
'weight': 2.0,
'year': 2014
}, {
'categories': ['Trains', 'Transportation', 'Video Game Theme'],
'game': 'Railways of the World',
'id': 17133,
'votes': 1,
'weight': 3.0,
'year': 2005
}, {
'categories': ['Card Game', 'Civilization', 'Economic', 'Science Fiction', 'Space Exploration'],
'game': 'Race For the Galaxy',
'id': 28143,
'votes': 1,
'weight': 2.0,
'year': 2007
}, {
'categories': ['Economic'],
'game': 'Ponzi Scheme',
'id': 180899,
'votes': 1,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Abstract Strategy', 'Deduction', 'Maze'],
'game': 'Pathfinder',
'id': 2884,
'votes': 1,
'weight': 1.0,
'year': 1974
}, {
'categories': ['Abstract Strategy'],
'game': 'Parade',
'id': 22239,
'votes': 1,
'weight': 1.0,
'year': 2005
}, {
'categories': ['Environmental', 'Medical'],
'game': 'Pandemic Legacy: Season 1',
'id': 161936,
'votes': 1,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Medieval', 'Religious', 'Travel'],
'game': 'Orleans',
'id': 164928,
'votes': 1,
'weight': 3.0,
'year': 2014
}, {
'categories': ['Card Game'],
'game': 'Oh Hell!',
'id': 1116,
'votes': 1,
'weight': 1.0,
'year': 1930
}, {
'categories': ['Card Game'],
'game': 'Nyet!',
'id': 1107,
'votes': 1,
'weight': 1.0,
'year': 1997
}, {
'categories': ['City Building', 'Economic'],
'game': 'Neue Heimat',
'id': 32944,
'votes': 1,
'weight': 2.0,
'year': 2007
}, {
'categories': ['Card Game', 'Fantasy', 'Fighting', 'Humor'],
'game': 'Munchkin',
'id': 1927,
'votes': 1,
'weight': 1.0,
'year': 2001
}, {
'categories': ['Word Game'],
'game': 'Montage',
'id': 5243,
'votes': 1,
'weight': 2.0,
'year': 1973
}, {
'categories': ['Economic', 'Negotiation'],
'game': 'Monopoly',
'id': 1406,
'votes': 1,
'weight': 1.0,
'year': 1933
}, {
'categories': ['Renaissance'],
'game': 'Medici',
'id': 46,
'votes': 1,
'weight': 2.0,
'year': 1995
}, {
'categories': ['Abstract Strategy'],
'game': 'Mahjong',
'id': 2093,
'votes': 1,
'weight': 2.0,
'year': 1850
}, {
'categories': ['Collectible Components', 'Fantasy', 'Miniatures', 'Wargame'],
'game': 'Mage Knight',
'id': 864,
'votes': 1,
'weight': 2.0,
'year': 2000
}, {
'categories': ['Dice', 'Memory'],
'game': 'Macao',
'id': 13258,
'votes': 1,
'weight': 1.0,
'year': 1982
}, {
'categories': ['Fantasy', 'Religious'],
'game': 'Luna',
'id': 70512,
'votes': 1,
'weight': 3.0,
'year': 2010
}, {
'categories': ['Bluffing', 'Card Game', 'Deduction', 'Renaissance'],
'game': 'Love Letter',
'id': 129622,
'votes': 1,
'weight': 1.0,
'year': 2012
}, {
'categories': ['Card Game', 'Pirates'],
'game': 'Libertalia',
'id': 125618,
'votes': 1,
'weight': 2.0,
'year': 2012
}, {
'categories': ['Bluffing', 'Dice', 'Movies / TV / Radio theme', 'Party Game'],
'game': "Liar's Dice",
'id': 45,
'votes': 1,
'weight': 1.0,
'year': 1987
}, {
'categories': ['Adventure', 'Exploration', 'Medieval'],
'game': 'Legends Untold',
'id': 198832,
'votes': 1,
'weight': 0.0,
'year': 2016
}, {
'categories': ['Card Game', 'Horror', 'Movies / TV / Radio theme', 'Science Fiction'],
'game': 'Legendary Encounters: An Alien Deck Building Game',
'id': 146652,
'votes': 1,
'weight': 2.0,
'year': 2014
}, {
'categories': ['City Building', 'Economic', 'Industry / Manufacturing', 'Nautical'],
'game': 'Le Havre',
'id': 35677,
'votes': 1,
'weight': 3.0,
'year': 2008
}, {
'categories': ['Abstract Strategy', 'Real-time'],
'game': 'La Boca',
'id': 136280,
'votes': 1,
'weight': 1.0,
'year': 2013
}, {
'categories': ['Dice', 'Fighting', 'Movies / TV / Radio theme', 'Science Fiction'],
'game': 'King Of Tokyo',
'id': 70323,
'votes': 1,
'weight': 1.0,
'year': 2011
}, {
'categories': ['Economic', 'Mafia', 'Science Fiction'],
'game': 'Infamy',
'id': 146559,
'votes': 1,
'weight': 2.0,
'year': 2013
}, {
'categories': ['Card Game', 'Novel-based', 'Political'],
'game': 'Illuminati',
'id': 859,
'votes': 1,
'weight': 2.0,
'year': 1982
}, {
'categories': ['Dice'],
'game': 'Greed',
'id': 4282,
'votes': 1,
'weight': 1.0,
'year': 1987
}, {
'categories': ['American West', 'Economic', 'Territory Building'],
'game': 'Gold West',
'id': 154086,
'votes': 1,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Ancient', 'Card Game', 'City Building', 'Economic'],
'game': 'Glory to Rome',
'id': 19857,
'votes': 1,
'weight': 2.0,
'year': 2005
}, {
'categories': ['City Building', 'Environmental', 'Science Fiction'],
'game': 'Ginkgopolis',
'id': 128271,
'votes': 1,
'weight': 2.0,
'year': 2012
}, {
'categories': ['Card Game', 'Fantasy'],
'game': 'GOSU',
'id': 66587,
'votes': 1,
'weight': 2.0,
'year': 2010
}, {
'categories': ['Card Game', 'Deduction', 'Horror'],
'game': 'Four Dragons',
'id': 950,
'votes': 1,
'weight': 2.0,
'year': 2000
}, {
'categories': ['Adventure', 'Science Fiction'],
'game': 'Forbidden Desert',
'id': 136063,
'votes': 1,
'weight': 2.0,
'year': 2013
}, {
'categories': ['Card Game', 'Economic'],
'game': 'For Sale',
'id': 172,
'votes': 1,
'weight': 1.0,
'year': 1997
}, {
'categories': ['Economic', 'Industry / Manufacturing'],
'game': 'Food Chain Magnate',
'id': 175914,
'votes': 1,
'weight': 4.0,
'year': 2015
}, {
'categories': ['Economic', 'Renaissance'],
'game': 'Firenze',
'id': 75449,
'votes': 1,
'weight': 2.0,
'year': 2010
}, {
'categories': ['Economic', 'Farming'],
'game': 'Finca',
'id': 40628,
'votes': 1,
'weight': 2.0,
'year': 2009
}, {
'categories': ['Card Game', "Children's Game", 'Movies / TV / Radio theme'],
'game': 'Dungeons & Dragons',
'id': 140509,
'votes': 1,
'weight': 0.0,
'year': 1985
}, {
'categories': ['Economic', 'Fantasy', 'Fighting', 'Humor'],
'game': 'Dungeon Lords',
'id': 45315,
'votes': 1,
'weight': 3.0,
'year': 2009
}, {
'categories': ['Sports'],
'game': 'Diamonds',
'id': 39945,
'votes': 1,
'weight': 0.0,
'year': 0
}, {
'categories': ['Bluffing', 'Horror', 'Zombies'],
'game': 'Dead of Winter: A Crossroads Game',
'id': 150376,
'votes': 1,
'weight': 2.0,
'year': 2014
}, {
'categories': ['Action / Dexterity'],
'game': 'Crokinole',
'id': 521,
'votes': 1,
'weight': 1.0,
'year': 1876
}, {
'categories': ['Wargame'],
'game': 'Coup',
'id': 1653,
'votes': 1,
'weight': 1.0,
'year': 1991
}, {
'categories': ['Economic'],
'game': 'Council of Four',
'id': 173101,
'votes': 1,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Ancient', 'Economic', 'Nautical'],
'game': 'Concordia',
'id': 124361,
'votes': 1,
'weight': 3.0,
'year': 2013
}, {
'categories': ['Party Game'],
'game': 'Concept',
'id': 147151,
'votes': 1,
'weight': 1.0,
'year': 2013
}, {
'categories': ['Ancient', 'Negotiation'],
'game': 'Colosseum',
'id': 27746,
'votes': 1,
'weight': 2.0,
'year': 2007
}, {
'categories': ['Fantasy', 'Fighting', 'Horror', 'Mythology', 'Wargame'],
'game': 'Chaos In the Old World',
'id': 43111,
'votes': 1,
'weight': 3.0,
'year': 2009
}, {
'categories': ['Animals', 'Economic', 'Fantasy', 'Farming'],
'game': 'Caverna: The Cave Farmers',
'id': 102794,
'votes': 1,
'weight': 3.0,
'year': 2013
}, {
'categories': ['Card Game'],
'game': 'The Castles of Burgundy: The Card Game',
'id': 191977,
'votes': 1,
'weight': 2.0,
'year': 2016
}, {
'categories': ['American West', 'City Building', 'Economic'],
'game': 'Carson City',
'id': 39938,
'votes': 1,
'weight': 3.0,
'year': 2009
}, {
'categories': ['Card Game', 'Fantasy', 'Horror', 'Novel-based'],
'game': 'Call of Cthulhu: The Card Game',
'id': 40270,
'votes': 1,
'weight': 2.0,
'year': 2008
}, {
'categories': ['Bluffing', 'Card Game', 'Fighting', 'Humor', 'Mafia', 'Negotiation', 'Party Game'],
'game': 'Ca$h n Gun$',
'id': 19237,
'votes': 1,
'weight': 1.0,
'year': 2005
}, {
'categories': ['Card Game', 'City Building', 'Dice', 'Economic', 'Renaissance'],
'game': 'Bruges',
'id': 136888,
'votes': 1,
'weight': 2.0,
'year': 2013
}, {
'categories': ['Bluffing', 'Card Game', 'Fantasy'],
'game': 'Broom Service',
'id': 172308,
'votes': 1,
'weight': 2.0,
'year': 2015
}, {
'categories': ['Economic', 'Industry / Manufacturing', 'Transportation'],
'game': 'Brass',
'id': 28720,
'votes': 1,
'weight': 3.0,
'year': 2007
}, {
'categories': ['Dice'],
'game': 'Bora Bora',
'id': 127060,
'votes': 1,
'weight': 3.0,
'year': 2013
}, {
'categories': ['Card Game', 'Economic', 'Medieval', 'Religious'],
'game': 'Biblios',
'id': 34219,
'votes': 1,
'weight': 1.0,
'year': 2007
}, {
'categories': ['Movies / TV / Radio theme', 'Science Fiction'],
'game': 'Battlestar Galactica',
'id': 2688,
'votes': 1,
'weight': 1.0,
'year': 1978
}, {
'categories': ['Exploration', 'Fantasy', 'Wargame'],
'game': 'Battlemist',
'id': 25,
'votes': 1,
'weight': 3.0,
'year': 1998
}, {
'categories': ['Fantasy', 'Miniatures', 'Wargame'],
'game': 'BattleLore (Second Edition)',
'id': 146439,
'votes': 1,
'weight': 2.0,
'year': 2013
}, {
'categories': ['Card Game', 'Fighting', 'Print & Play'],
'game': 'BattleCON: Devastation of Indines',
'id': 123123,
'votes': 1,
'weight': 3.0,
'year': 2013
}, {
'categories': ['Adventure', 'Horror', 'Novel-based'],
'game': 'Arkham Horror',
'id': 34,
'votes': 1,
'weight': 2.0,
'year': 1987
}, {
'categories': ['Adventure', 'Fantasy', 'Miniatures'],
'game': 'Arcadia Quest',
'id': 155068,
'votes': 1,
'weight': 2.0,
'year': 2014
}, {
'categories': ['Action / Dexterity', 'Animals', "Children's Game"],
'game': 'Animal Upon Animal',
'id': 17329,
'votes': 1,
'weight': 1.0,
'year': 2005
}, {
'categories': ['Bluffing', 'Card Game', 'Science Fiction'],
'game': 'Android: Netrunner',
'id': 124742,
'votes': 1,
'weight': 3.0,
'year': 2012
}, {
'categories': ['Word Game'],
'game': 'Anagrams',
'id': 3359,
'votes': 1,
'weight': 2.0,
'year': 1910
}, {
'categories': ['Adventure', 'Spies/Secret Agents'],
'game': 'Agents of SMERSH',
'id': 111105,
'votes': 1,
'weight': 2.0,
'year': 2012
}, {
'categories': ['Card Game', 'City Building', 'Economic', 'Science Fiction'],
'game': '51st State',
'id': 73369,
'votes': 1,
'weight': 3.0,
'year': 2010
}
]
raw_categories = []
final_categories = OrderedDict()
raw_years = []
raw_weights = []
final_years = OrderedDict()
final_weights = OrderedDict()
for game in games:
raw_categories.extend(game.get('categories'))
raw_years.append(game.get('year'))
raw_weights.append(game.get('weight'))
for category in sorted(raw_categories):
try:
final_categories[category] += 1
except KeyError:
final_categories[category] = 1
for year in sorted(raw_years):
try:
final_years[year] += 1
except KeyError:
final_years[year] = 1
for weight in sorted(raw_weights):
try:
final_weights[weight] += 1
except KeyError:
final_weights[weight] = 1
#!/usr/local/bin/python
# coding: utf-8
import math
from boardgamegeek import BoardGameGeek
import requests
requests.packages.urllib3.disable_warnings()
bgg = BoardGameGeek()
games = [{
'game': 'Codenames',
'votes': 9,
}, {
'game': '6 Nimmt!',
'votes': 6,
}, {
'game': '7 Wonders',
'votes': 5,
}, {
'game': 'Terra Mystica',
'votes': 4,
}, {
'game': 'The Castles of Burgundy',
'votes': 4,
}, {
'game': 'Power Grid',
'votes': 3,
}, {
'game': 'Sentinels of the Multiverse',
'votes': 3,
}, {
'game': 'Pandemic',
'votes': 3,
}, {
'game': 'Lords of Waterdeep',
'votes': 3,
}, {
'game': 'Dominion',
'votes': 3,
}, {
'game': 'Betrayal at House on the Hill',
'votes': 3,
}, {
'game': 'Yspahan',
'votes': 2,
}, {
'game': 'Trajan',
'votes': 2,
}, {
'game': 'Ticket to Ride',
'votes': 2,
}, {
'game': 'Through the Ages: A Story of Civilization',
'votes': 2,
}, {
'game': 'T.I.M.E Stories',
'votes': 2,
}, {
'game': 'catan',
'votes': 2,
}, {
'game': 'Puerto Rico',
'votes': 2,
}, {
'game': 'Las Vegas',
'votes': 2,
}, {
'game': 'Keyflower',
'votes': 2,
}, {
'game': 'Hanabi',
'votes': 2,
}, {
'game': "Flick 'Em Up!",
'votes': 2,
}, {
'game': 'Five Tribes',
'votes': 2,
}, {
'game': 'Dominant Species',
'votes': 2,
}, {
'game': 'Carcassonne',
'votes': 2,
}, {
'game': 'Burgle Bros.',
'votes': 2,
}, {
'game': 'Blood Rage',
'votes': 2,
}, {
'game': 'Bang!',
'votes': 2,
}, {
'game': 'Alchemists',
'votes': 2,
}, {
'game': 'Twilight Imperium (Third Edition)',
'votes': 2,
}, {
'game': 'Magic: the Gathering',
'votes': 2,
}, {
'game': 'Zhanguo',
'votes': 1,
}, {
'game': 'Zendo',
'votes': 1,
}, {
'game': 'Yakitori',
'votes': 1,
}, {
'game': 'Witch of Salem',
'votes': 1,
}, {
'game': 'Viticulture',
'votes': 1,
}, {
'game': 'TurfMaster',
'votes': 1,
}, {
'game': 'Tokaido',
'votes': 1,
}, {
'game': "Time's Up! Title Recall!",
'votes': 1,
}, {
'game': 'Tichu',
'votes': 1,
}, {
'game': 'The Speicherstadt',
'votes': 1,
}, {
'game': 'The Resistance',
'votes': 1,
}, {
'game': 'The Networks',
'votes': 1,
}, {
'game': 'The Grizzled',
'votes': 1,
}, {
'game': 'The Great Dalmuti',
'votes': 1,
}, {
'game': 'The Gallerist',
'votes': 1,
}, {
'game': 'Takenoko',
'votes': 1,
}, {
'game': 'Survive: Escape from Atlantis!',
'votes': 1,
}, {
'game': 'Succession',
'votes': 1,
}, {
'game': 'Steam Works',
'votes': 1,
}, {
'game': 'Star Wars: Rebellion',
'votes': 1,
}, {
'game': 'Small World',
'votes': 1,
}, {
'game': 'Sheriff of Nottingham',
'votes': 1,
}, {
'game': 'Shadows over Camelot',
'votes': 1,
}, {
'game': 'Set',
'votes': 1,
}, {
'game': 'Sentinels of the Multiverse',
'votes': 1,
}, {
'game': 'Samurai',
'votes': 1,
}, {
'game': 'Rococo',
'votes': 1,
}, {
'game': 'Resistance',
'votes': 1,
}, {
'game': '[redacted]',
'votes': 1,
}, {
'game': 'Railways of the World',
'votes': 1,
}, {
'game': 'Race For the Galaxy',
'votes': 1,
}, {
'game': 'Ponzi Scheme',
'votes': 1,
}, {
'game': 'Pathfinder',
'votes': 1,
}, {
'game': 'Parade',
'votes': 1,
}, {
'game': 'Pandemic Legacy: Season 1',
'votes': 1,
}, {
'game': 'Orleans',
'votes': 1,
}, {
'game': 'Oh Hell!',
'votes': 1,
}, {
'game': 'Nyet!',
'votes': 1,
}, {
'game': 'Neue Heimat',
'votes': 1,
}, {
'game': 'Munchkin',
'votes': 1,
}, {
'game': 'Montage',
'votes': 1,
}, {
'game': 'Monopoly',
'votes': 1,
}, {
'game': 'Medici',
'votes': 1,
}, {
'game': 'Mahjong',
'votes': 1,
}, {
'game': 'Mage Knight',
'votes': 1,
}, {
'game': 'Macao',
'votes': 1,
}, {
'game': 'Luna',
'votes': 1,
}, {
'game': 'Love Letter',
'votes': 1,
}, {
'game': 'Libertalia',
'votes': 1,
}, {
'game': "Liar's Dice",
'votes': 1,
}, {
'game': 'Legends Untold',
'votes': 1,
}, {
'game': 'Legendary Encounters: An Alien Deck Building Game',
'votes': 1,
}, {
'game': 'Le Havre',
'votes': 1,
}, {
'game': 'La Boca',
'votes': 1,
}, {
'game': 'King Of Tokyo',
'votes': 1,
}, {
'game': 'Infamy',
'votes': 1,
}, {
'game': 'Illuminati',
'votes': 1,
}, {
'game': 'Greed',
'votes': 1,
}, {
'game': 'Gold West',
'votes': 1,
}, {
'game': 'Glory to Rome',
'votes': 1,
}, {
'game': 'Ginkgopolis',
'votes': 1,
}, {
'game': 'GOSU',
'votes': 1,
}, {
'game': 'Four Dragons',
'votes': 1,
}, {
'game': 'Forbidden Desert',
'votes': 1,
}, {
'game': 'For Sale',
'votes': 1,
}, {
'game': 'Food Chain Magnate',
'votes': 1,
}, {
'game': 'Firenze',
'votes': 1,
}, {
'game': 'Finca',
'votes': 1,
}, {
'game': 'Dungeons & Dragons',
'votes': 1,
}, {
'game': 'Dungeon Lords',
'votes': 1,
}, {
'game': 'Diamonds',
'votes': 1,
'year': 0
}, {
'game': 'Dead of Winter: A Crossroads Game',
'votes': 1,
}, {
'game': 'D&D 5th Edition RPG',
'votes': 1
}, {
'game': 'D&D 5e',
'votes': 1
}, {
'game': 'Crokinole',
'votes': 1,
}, {
'game': 'Coup',
'votes': 1,
}, {
'game': 'Council of Four',
'votes': 1,
}, {
'game': 'Concordia',
'votes': 1,
}, {
'game': 'Concept',
'votes': 1,
}, {
'game': 'Colosseum',
'votes': 1,
}, {
'game': 'Chaos In the Old World',
'votes': 1,
}, {
'game': 'Caverna: The Cave Farmers',
'votes': 1,
}, {
'game': 'The Castles of Burgundy: The Card Game',
'votes': 1,
}, {
'game': 'Carson City',
'votes': 1,
}, {
'game': 'Call of Cthulhu: The Card Game',
'votes': 1,
}, {
'game': 'Ca$h n Gun$',
'votes': 1,
}, {
'game': 'Bruges',
'votes': 1,
}, {
'game': 'Broom Service',
'votes': 1,
}, {
'game': 'Brass',
'votes': 1,
}, {
'game': 'Bora Bora',
'votes': 1,
}, {
'game': 'Biblios',
'votes': 1,
}, {
'game': 'Battlestar Galactica',
'votes': 1,
}, {
'game': 'Battlemist',
'votes': 1,
}, {
'game': 'BattleLore (Second Edition)',
'votes': 1,
}, {
'game': 'BattleCON: Devastation of Indines',
'votes': 1,
}, {
'game': 'Arkham Horror',
'votes': 1,
}, {
'game': 'Arcadia Quest',
'votes': 1,
}, {
'game': 'Animal Upon Animal',
'votes': 1,
}, {
'game': 'Android: Netrunner',
'votes': 1,
}, {
'game': 'Anagrams',
'votes': 1,
}, {
'game': 'Agents of SMERSH',
'votes': 1,
}, {
'game': '51st State',
'votes': 1,
}]
for game in games:
bgg_game = bgg.game(game.get('game'))
try:
game.update(
id=bgg_game.id,
year=bgg_game.year,
weight=math.floor(bgg_game.rating_average_weight),
categories=bgg_game.categories,
)
except Exception:
print game.get('game')
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.