Last active
January 12, 2016 22:42
-
-
Save phil-lopreiato/897322276a608edc7de4 to your computer and use it in GitHub Desktop.
Percentage of FRC Teams winning their events as top seed
This file contains 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
[u'2011arc', u'2011az', u'2011ca', u'2011co', u'2011ct', u'2011cur', u'2011da', u'2011dc', u'2011dmn', u'2011dt', u'2011fl', u'2011ga', u'2011gal', u'2011gg', u'2011gl', u'2011gt', u'2011hi', u'2011il', u'2011in', u'2011is', u'2011kc', u'2011la', u'2011li', u'2011ma', u'2011md', u'2011mi', u'2011mn', u'2011mn2', u'2011mo', u'2011nc', u'2011new', u'2011nh', u'2011nj', u'2011nv', u'2011ny', u'2011oc', u'2011oc1', u'2011oh', u'2011ok', u'2011on', u'2011on2', u'2011or', u'2011pa', u'2011pit', u'2011roc', u'2011sac', u'2011sc', u'2011sdc', u'2011sj', u'2011stx', u'2011swm', u'2011tn', u'2011tx', u'2011ut', u'2011va', u'2011wa', u'2011wa2', u'2011wat', u'2011wc', u'2011wi', u'2011wor', u'2011ww', u'2012arc', u'2012az', u'2012ca', u'2012caf', u'2012co', u'2012ct', u'2012cur', u'2012da', u'2012da2', u'2012dc', u'2012dmn', u'2012dt', u'2012fl', u'2012ga', u'2012gal', u'2012gg', u'2012gl', u'2012gt', u'2012hi', u'2012il', u'2012in', u'2012is', u'2012kc', u'2012la', u'2012li', u'2012ma', u'2012md', u'2012mi', u'2012migl', u'2012mn', u'2012mn2', u'2012mo', u'2012nc', u'2012new', u'2012nh', u'2012nj', u'2012njf', u'2012njt', u'2012nv', u'2012ny', u'2012oc', u'2012oc1', u'2012oh', u'2012ohc', u'2012ok', u'2012on', u'2012on2', u'2012or', u'2012pa', u'2012pah', u'2012phl', u'2012pit', u'2012qc', u'2012roc', u'2012sac', u'2012sc', u'2012sdc', u'2012sfl', u'2012sj', u'2012stx', u'2012swm', u'2012tn', u'2012tx', u'2012ut', u'2012va', u'2012wa', u'2012wa2', u'2012was', u'2012wat', u'2012wca', u'2012wi', u'2012wor', u'2012ww', u'2013abca', u'2013arc', u'2013arfa', u'2013azch', u'2013calb', u'2013cama', u'2013casa', u'2013casb', u'2013casd', u'2013casj', u'2013code', u'2013ctha', u'2013cur', u'2013dcwa', u'2013flbr', u'2013flor', u'2013gadu', u'2013gal', u'2013hiho', u'2013ilch', u'2013inth', u'2013inwl', u'2013ista', u'2013lake', u'2013mabo', u'2013mawo', u'2013mdba', u'2013mele', u'2013mibed', u'2013micmp', u'2013midet', u'2013migbl', u'2013migul', u'2013miket', u'2013miliv', u'2013misjo', u'2013mitry', u'2013mitvc', u'2013miwfd', u'2013miwmi', u'2013mndu', u'2013mndu2', u'2013mnmi', u'2013mnmi2', u'2013mokc', u'2013mosl', u'2013mrcmp', u'2013ncre', u'2013new', u'2013nhma', u'2013njbrg', u'2013njewn', u'2013njfla', u'2013njlen', u'2013nvlv', u'2013nyli', u'2013nyny', u'2013nyro', u'2013ohcl', u'2013ohic', u'2013okok', u'2013onto', u'2013onto2', u'2013onwa', u'2013orpo', u'2013pahat', u'2013paphi', u'2013papi', u'2013qcmo', u'2013scmb', u'2013tnkn', u'2013txda', u'2013txho', u'2013txlu', u'2013txsa', u'2013utwv', u'2013vari', u'2013wach', u'2013wase', u'2013wase2', u'2013wimi', u'2014abca', u'2014arc', u'2014arfa', u'2014azch', u'2014calb', u'2014cama', u'2014casa', u'2014casb', u'2014casd', u'2014casj', u'2014code', u'2014ctgro', u'2014cthar', u'2014ctsou', u'2014cur', u'2014dcwa', u'2014flfo', u'2014flor', u'2014gadu', u'2014gal', u'2014hiho', u'2014ilch', u'2014ilil', u'2014inth', u'2014inwl', u'2014ista', u'2014lake', u'2014mabos', u'2014mawor', u'2014mdba', u'2014melew', u'2014mibed', u'2014micen', u'2014micmp', u'2014miesc', u'2014migul', u'2014mihow', u'2014miket', u'2014milan', u'2014miliv', u'2014mimid', u'2014misjo', u'2014misou', u'2014mitry', u'2014mitvc', u'2014miwat', u'2014miwmi', u'2014mndu', u'2014mndu2', u'2014mnmi', u'2014mnmi2', u'2014mokc', u'2014mosl', u'2014mrcmp', u'2014mxmc', u'2014ncre', u'2014necmp', u'2014new', u'2014nhdur', u'2014nhnas', u'2014njbri', u'2014njcli', u'2014njfla', u'2014njtab', u'2014nvlv', u'2014nyli', u'2014nyny', u'2014nyro', u'2014nytr', u'2014ohci', u'2014ohcl', u'2014okok', u'2014onnb', u'2014onto', u'2014onto2', u'2014onwa', u'2014onwi', u'2014orore', u'2014orosu', u'2014orwil', u'2014pahat', u'2014paphi', u'2014papi', u'2014pncmp', u'2014qcmo', u'2014rismi', u'2014scmb', u'2014tnkn', u'2014txda', u'2014txho', u'2014txlu', u'2014txsa', u'2014utwv', u'2014vari', u'2014waahs', u'2014waamv', u'2014wache', u'2014waell', u'2014wamou', u'2014washo', u'2014wasno', u'2014wimi', u'2015abca', u'2015arc', u'2015arfa', u'2015ausy', u'2015azch', u'2015azpx', u'2015calb', u'2015cama', u'2015carm', u'2015cars', u'2015carv', u'2015casa', u'2015casd', u'2015casj', u'2015cave', u'2015code', u'2015cthar', u'2015ctwat', u'2015cur', u'2015dcwa', u'2015flfo', u'2015flor', u'2015gadu', u'2015gal', u'2015gape', u'2015hiho', u'2015hop', u'2015ilch', u'2015ilil', u'2015incmp', u'2015inind', u'2015inkok', u'2015inwla', u'2015ista', u'2015lake', u'2015mabos', u'2015manda', u'2015marea', u'2015maspr', u'2015mdcp', u'2015melew', u'2015mibed', u'2015micen', u'2015micmp', u'2015miesc', u'2015mifla', u'2015migul', u'2015mihow', u'2015miken', u'2015miket', u'2015milan', u'2015miliv', u'2015mimid', u'2015misjo', u'2015misou', u'2015mista', u'2015mitry', u'2015mitvc', u'2015miwat', u'2015miwmi', u'2015mndu', u'2015mndu2', u'2015mnmi', u'2015mnmi2', u'2015mokc', u'2015mosl', u'2015mrcmp', u'2015mxmc', u'2015ncre', u'2015necmp', u'2015new', u'2015nhdur', u'2015nhnas', u'2015njbri', u'2015njfla', u'2015njnbr', u'2015njtab', u'2015nvlv', u'2015nyli', u'2015nyny', u'2015nyro', u'2015nytr', u'2015ohci', u'2015ohcl', u'2015okok', u'2015onnb', u'2015onto', u'2015onto2', u'2015onwa', u'2015onwi', u'2015orore', u'2015orphi', u'2015orwil', u'2015padre', u'2015pahat', u'2015paphi', u'2015papi', u'2015pncmp', u'2015qcmo', u'2015rismi', u'2015scmb', u'2015tes', u'2015tnkn', u'2015txda', u'2015txho', u'2015txlu', u'2015txsa', u'2015utwv', u'2015vari', u'2015waahs', u'2015waamv', u'2015waell', u'2015wamou', u'2015washo', u'2015wasno', u'2015waspo', u'2015wimi'] | |
Event 2011arc won by top seed frc2016 | |
Event 2011az won by top seed frc842 | |
Event 2011co won by top seed frc1986 | |
Event 2011ct won by top seed frc1923 | |
Event 2011da won by top seed frc148 | |
Event 2011dc won by top seed frc768 | |
Event 2011dmn won by top seed frc2512 | |
Event 2011dt won by top seed frc217 | |
Event 2011fl won by top seed frc179 | |
Event 2011ga won by top seed frc2415 | |
Event 2011gg won by top seed frc33 | |
Event 2011gt won by top seed frc1918 | |
Event 2011hi won by top seed frc359 | |
Event 2011il won by top seed frc111 | |
Event 2011in won by top seed frc2081 | |
Event 2011kc won by top seed frc525 | |
Event 2011li won by top seed frc1626 | |
Event 2011ma won by top seed frc88 | |
Event 2011mn won by top seed frc525 | |
Event 2011mo won by top seed frc1985 | |
Event 2011nj won by top seed frc1676 | |
Event 2011nv won by top seed frc2984 | |
Event 2011ny won by top seed frc395 | |
Event 2011oc won by top seed frc2337 | |
Event 2011ok won by top seed frc932 | |
Event 2011on won by top seed frc1114 | |
Event 2011on2 won by top seed frc2056 | |
Event 2011pit won by top seed frc1114 | |
Event 2011roc won by top seed frc2056 | |
Event 2011sc won by top seed frc180 | |
Event 2011sdc won by top seed frc254 | |
Event 2011sj won by top seed frc254 | |
Event 2011stx won by top seed frc16 | |
Event 2011tn won by top seed frc71 | |
Event 2011tx won by top seed frc118 | |
Event 2011ut won by top seed frc2122 | |
Event 2011wa2 won by top seed frc2471 | |
Event 2011wat won by top seed frc1114 | |
Event 2011wc won by top seed frc2337 | |
Event 2011wi won by top seed frc111 | |
Event 2011ww won by top seed frc1023 | |
Event 2012az won by top seed frc610 | |
Event 2012ca won by top seed frc987 | |
Event 2012caf won by top seed frc1717 | |
Event 2012co won by top seed frc2996 | |
Event 2012da won by top seed frc16 | |
Event 2012da2 won by top seed frc935 | |
Event 2012dmn won by top seed frc1714 | |
Event 2012dt won by top seed frc1023 | |
Event 2012gg won by top seed frc2337 | |
Event 2012gl won by top seed frc469 | |
Event 2012hi won by top seed frc2439 | |
Event 2012il won by top seed frc16 | |
Event 2012is won by top seed frc1662 | |
Event 2012kc won by top seed frc1986 | |
Event 2012la won by top seed frc1477 | |
Event 2012li won by top seed frc527 | |
Event 2012ma won by top seed frc341 | |
Event 2012migl won by top seed frc1918 | |
Event 2012mo won by top seed frc1986 | |
Event 2012nc won by top seed frc1519 | |
Event 2012new won by top seed frc548 | |
Event 2012nh won by top seed frc131 | |
Event 2012nj won by top seed frc1676 | |
Event 2012nv won by top seed frc987 | |
Event 2012oc won by top seed frc67 | |
Event 2012oc1 won by top seed frc67 | |
Event 2012oh won by top seed frc1507 | |
Event 2012ok won by top seed frc3528 | |
Event 2012on won by top seed frc1114 | |
Event 2012pa won by top seed frc341 | |
Event 2012pah won by top seed frc341 | |
Event 2012phl won by top seed frc341 | |
Event 2012pit won by top seed frc48 | |
Event 2012qc won by top seed frc2590 | |
Event 2012roc won by top seed frc1507 | |
Event 2012sac won by top seed frc1678 | |
Event 2012sdc won by top seed frc4161 | |
Event 2012sfl won by top seed frc180 | |
Event 2012sj won by top seed frc971 | |
Event 2012tn won by top seed frc772 | |
Event 2012tx won by top seed frc359 | |
Event 2012wa2 won by top seed frc2046 | |
Event 2012was won by top seed frc2122 | |
Event 2012wat won by top seed frc1114 | |
Event 2012wca won by top seed frc67 | |
Event 2012ww won by top seed frc3322 | |
Event 2013abca won by top seed frc1334 | |
Event 2013arfa won by top seed frc1477 | |
Event 2013azch won by top seed frc1726 | |
Event 2013casb won by top seed frc1538 | |
Event 2013casd won by top seed frc987 | |
Event 2013casj won by top seed frc254 | |
Event 2013code won by top seed frc701 | |
Event 2013ctha won by top seed frc20 | |
Event 2013cur won by top seed frc1678 | |
Event 2013flbr won by top seed frc180 | |
Event 2013inth won by top seed frc868 | |
Event 2013inwl won by top seed frc359 | |
Event 2013lake won by top seed frc3753 | |
Event 2013mabo won by top seed frc125 | |
Event 2013mele won by top seed frc2648 | |
Event 2013mibed won by top seed frc469 | |
Event 2013midet won by top seed frc469 | |
Event 2013migbl won by top seed frc33 | |
Event 2013migul won by top seed frc2054 | |
Event 2013miket won by top seed frc70 | |
Event 2013misjo won by top seed frc2959 | |
Event 2013mitvc won by top seed frc1918 | |
Event 2013miwfd won by top seed frc1718 | |
Event 2013miwmi won by top seed frc862 | |
Event 2013mnmi won by top seed frc2052 | |
Event 2013mokc won by top seed frc1986 | |
Event 2013mrcmp won by top seed frc2729 | |
Event 2013ncre won by top seed frc435 | |
Event 2013nhma won by top seed frc610 | |
Event 2013njbrg won by top seed frc3314 | |
Event 2013njfla won by top seed frc222 | |
Event 2013nvlv won by top seed frc3245 | |
Event 2013okok won by top seed frc1986 | |
Event 2013onto won by top seed frc2056 | |
Event 2013onto2 won by top seed frc2056 | |
Event 2013onwa won by top seed frc2056 | |
Event 2013orpo won by top seed frc955 | |
Event 2013pahat won by top seed frc2590 | |
Event 2013papi won by top seed frc1503 | |
Event 2013qcmo won by top seed frc3990 | |
Event 2013tnkn won by top seed frc3824 | |
Event 2013txda won by top seed frc148 | |
Event 2013txho won by top seed frc118 | |
Event 2013txlu won by top seed frc1986 | |
Event 2013utwv won by top seed frc359 | |
Event 2013wase won by top seed frc948 | |
Event 2014abca won by top seed frc4334 | |
Event 2014arfa won by top seed frc16 | |
Event 2014azch won by top seed frc2486 | |
Event 2014cama won by top seed frc254 | |
Event 2014casa won by top seed frc971 | |
Event 2014casb won by top seed frc1678 | |
Event 2014casj won by top seed frc971 | |
Event 2014code won by top seed frc1138 | |
Event 2014cthar won by top seed frc558 | |
Event 2014ctsou won by top seed frc195 | |
Event 2014cur won by top seed frc254 | |
Event 2014dcwa won by top seed frc225 | |
Event 2014flfo won by top seed frc180 | |
Event 2014hiho won by top seed frc368 | |
Event 2014ilch won by top seed frc2451 | |
Event 2014ilil won by top seed frc525 | |
Event 2014ista won by top seed frc3316 | |
Event 2014mabos won by top seed frc125 | |
Event 2014mdba won by top seed frc1629 | |
Event 2014melew won by top seed frc155 | |
Event 2014miesc won by top seed frc107 | |
Event 2014mihow won by top seed frc67 | |
Event 2014miket won by top seed frc2337 | |
Event 2014milan won by top seed frc67 | |
Event 2014misjo won by top seed frc3620 | |
Event 2014misou won by top seed frc33 | |
Event 2014mndu2 won by top seed frc2175 | |
Event 2014mokc won by top seed frc118 | |
Event 2014mosl won by top seed frc1501 | |
Event 2014new won by top seed frc1678 | |
Event 2014nhnas won by top seed frc138 | |
Event 2014nvlv won by top seed frc2485 | |
Event 2014nyny won by top seed frc334 | |
Event 2014nyro won by top seed frc1507 | |
Event 2014nytr won by top seed frc1126 | |
Event 2014ohcl won by top seed frc910 | |
Event 2014onnb won by top seed frc188 | |
Event 2014onto2 won by top seed frc1310 | |
Event 2014onwi won by top seed frc1114 | |
Event 2014orore won by top seed frc4488 | |
Event 2014orwil won by top seed frc4488 | |
Event 2014pahat won by top seed frc2590 | |
Event 2014qcmo won by top seed frc3990 | |
Event 2014scmb won by top seed frc3824 | |
Event 2014txda won by top seed frc148 | |
Event 2014txho won by top seed frc148 | |
Event 2014txlu won by top seed frc1817 | |
Event 2014txsa won by top seed frc624 | |
Event 2014vari won by top seed frc2607 | |
Event 2014waahs won by top seed frc1318 | |
Event 2014wache won by top seed frc4125 | |
Event 2015abca won by top seed frc4719 | |
Event 2015arc won by top seed frc1023 | |
Event 2015arfa won by top seed frc2481 | |
Event 2015azpx won by top seed frc2122 | |
Event 2015calb won by top seed frc330 | |
Event 2015cama won by top seed frc1678 | |
Event 2015carm won by top seed frc1572 | |
Event 2015casa won by top seed frc118 | |
Event 2015casj won by top seed frc254 | |
Event 2015cave won by top seed frc330 | |
Event 2015code won by top seed frc1619 | |
Event 2015cthar won by top seed frc195 | |
Event 2015ctwat won by top seed frc236 | |
Event 2015cur won by top seed frc148 | |
Event 2015dcwa won by top seed frc3419 | |
Event 2015hiho won by top seed frc359 | |
Event 2015hop won by top seed frc987 | |
Event 2015ilil won by top seed frc2481 | |
Event 2015incmp won by top seed frc234 | |
Event 2015inkok won by top seed frc234 | |
Event 2015inwla won by top seed frc234 | |
Event 2015ista won by top seed frc3339 | |
Event 2015mabos won by top seed frc1519 | |
Event 2015manda won by top seed frc1519 | |
Event 2015mdcp won by top seed frc1690 | |
Event 2015melew won by top seed frc4564 | |
Event 2015mibed won by top seed frc1023 | |
Event 2015micen won by top seed frc2834 | |
Event 2015micmp won by top seed frc1023 | |
Event 2015miesc won by top seed frc2054 | |
Event 2015mifla won by top seed frc1023 | |
Event 2015migul won by top seed frc4381 | |
Event 2015mihow won by top seed frc4384 | |
Event 2015miken won by top seed frc3620 | |
Event 2015miket won by top seed frc314 | |
Event 2015milan won by top seed frc314 | |
Event 2015miliv won by top seed frc67 | |
Event 2015mimid won by top seed frc314 | |
Event 2015misou won by top seed frc33 | |
Event 2015mista won by top seed frc1025 | |
Event 2015mitry won by top seed frc33 | |
Event 2015mitvc won by top seed frc245 | |
Event 2015miwat won by top seed frc67 | |
Event 2015miwmi won by top seed frc1918 | |
Event 2015mndu2 won by top seed frc3130 | |
Event 2015mnmi won by top seed frc525 | |
Event 2015mnmi2 won by top seed frc2826 | |
Event 2015mosl won by top seed frc1986 | |
Event 2015mrcmp won by top seed frc316 | |
Event 2015ncre won by top seed frc1225 | |
Event 2015necmp won by top seed frc1519 | |
Event 2015new won by top seed frc118 | |
Event 2015nhnas won by top seed frc1519 | |
Event 2015njbri won by top seed frc1676 | |
Event 2015njnbr won by top seed frc303 | |
Event 2015njtab won by top seed frc1640 | |
Event 2015nvlv won by top seed frc148 | |
Event 2015ohci won by top seed frc1986 | |
Event 2015ohcl won by top seed frc379 | |
Event 2015okok won by top seed frc1806 | |
Event 2015onnb won by top seed frc4678 | |
Event 2015onto won by top seed frc2056 | |
Event 2015onto2 won by top seed frc1114 | |
Event 2015onwa won by top seed frc1114 | |
Event 2015onwi won by top seed frc1114 | |
Event 2015orore won by top seed frc4488 | |
Event 2015orphi won by top seed frc1983 | |
Event 2015orwil won by top seed frc2635 | |
Event 2015padre won by top seed frc225 | |
Event 2015paphi won by top seed frc225 | |
Event 2015qcmo won by top seed frc3360 | |
Event 2015scmb won by top seed frc3824 | |
Event 2015tnkn won by top seed frc3824 | |
Event 2015txho won by top seed frc118 | |
Event 2015txlu won by top seed frc2468 | |
Event 2015txsa won by top seed frc1296 | |
Event 2015utwv won by top seed frc624 | |
Event 2015waahs won by top seed frc2522 | |
Event 2015waamv won by top seed frc1983 | |
Event 2015waell won by top seed frc4488 | |
Event 2015wamou won by top seed frc1983 | |
Event 2015washo won by top seed frc1318 | |
Overall 266 of 435 events were won by top seeds (61.1494252874 percent) | |
In 2011, 62 of 41 events were won by top seeds (66.1290322581 percent) | |
In 2012, 73 of 46 events were won by top seeds (63.0136986301 percent) | |
In 2013, 81 of 46 events were won by top seeds (56.7901234568 percent) | |
In 2014, 102 of 51 events were won by top seeds (50.0 percent) | |
In 2015, 117 of 82 events were won by top seeds (70.0854700855 percent) |
This file contains 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
#! /usr/bin/python | |
import argparse | |
import json | |
import urllib2 | |
""" | |
A script to determine how many #1 seeds win events using The Blue Alliance API (as determined by awards) | |
Considers REGIONAL, DISTRICT, DISTRICT_CMP, and CMP_DIVISION types | |
In response to http://www.chiefdelphi.com/forums/showpost.php?p=1522141&postcount=10 | |
""" | |
BASE_URL = 'https://www.thebluealliance.com/api/v2/{}' | |
APP_HEADER = 'X-TBA-App-Id' | |
APP_ID = 'plnyyanks:topseeds:v0.1' | |
# See https://github.com/the-blue-alliance/the-blue-alliance/blob/master/consts/event_type.py | |
VALID_EVENT_TYPES = [0, 1, 2, 3] | |
# See https://github.com/the-blue-alliance/the-blue-alliance/blob/master/consts/award_type.py | |
VALID_AWARD_TYPES = [1] | |
def fetch_endpoint(endpoint): | |
full_url = BASE_URL.format(endpoint) | |
url = urllib2.Request(full_url, headers={APP_HEADER: APP_ID}) | |
response = urllib2.urlopen(url) | |
return json.loads(response.read()) | |
def fetch_event_keys_in_year(year): | |
api_events = fetch_endpoint("events/{}".format(year)) | |
return [event["key"] for event in api_events if event["event_type"] in VALID_EVENT_TYPES] | |
def fetch_event_rankings(event_key): | |
return fetch_endpoint("event/{}/rankings".format(event_key)) | |
def fetch_event_awards(event_key): | |
return fetch_endpoint("event/{}/awards".format(event_key)) | |
def fetch_event_winners(event_key): | |
awards = fetch_event_awards(event_key) | |
winners = [] | |
for award in awards: | |
if award["award_type"] in VALID_AWARD_TYPES: | |
for winner in award["recipient_list"]: | |
winners.append("frc{}".format(winner["team_number"])) | |
return winners | |
def fetch_event_top_seed(event_key): | |
rankings = fetch_event_rankings(event_key) | |
return "frc{}".format(rankings[1][1]) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser() | |
parser.add_argument("--start", help="First competition season to test", type=int, default=2014) | |
parser.add_argument("--end", help="Last competition season to test, inclusive", type=int, default=2015) | |
args = parser.parse_args() | |
# Build list of all relevent event keys | |
event_keys = [] | |
for year in range(args.start, args.end + 1): | |
event_keys.extend(fetch_event_keys_in_year(year)) | |
print event_keys | |
# Check if each event was won by the #1 seed | |
total_events = len(event_keys) | |
num_won_by_top = 0 | |
events_per_year = {} | |
events_won_per_year = {} | |
years = [] | |
for event_key in event_keys: | |
year = int(event_key[:4]) | |
if year not in years: | |
years.append(year) | |
if year not in events_per_year: | |
events_per_year[year] = 0 | |
events_per_year[year] = events_per_year[year] + 1 | |
winners = fetch_event_winners(event_key) | |
top_seed = fetch_event_top_seed(event_key) | |
if top_seed in winners: | |
print "Event {} won by top seed {}".format(event_key, top_seed) | |
num_won_by_top = num_won_by_top + 1 | |
if year not in events_won_per_year: | |
events_won_per_year[year] = 0 | |
events_won_per_year[year] = events_won_per_year[year] + 1 | |
total_percent = num_won_by_top / float(total_events) * 100 | |
print "Overall {} of {} events were won by top seeds ({} percent)".format(num_won_by_top, total_events, total_percent) | |
for year in years: | |
percent = events_won_per_year[year] / float(events_per_year[year]) * 100 | |
print " In {}, {} of {} events were won by top seeds ({} percent)".format(year, events_per_year[year], events_won_per_year[year], percent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment