예제 #1
0
def main():
    playoffsdf = pd.read_csv("Goaltending_playoffs.csv", sep=',')
    playoffsdf = modifydf(playoffsdf, True)
    regulardf = pd.read_csv("Goaltending_regularSeason.csv", sep=',')
    regulardf.rename(columns={'Season': 'Year'}, inplace=True)
    regulardf = modifydf(regulardf, False)
    pensPlayoffdf = playoffsdf[(playoffsdf.Tm == 'PIT')]
    pensRegulardf = regulardf[(regulardf.Tm == 'PIT')]
    savePercent = getDataFrame(pensPlayoffdf, pensRegulardf, 'SV%', True)
    plotFigure(savePercent, "bar",
               "Penguins Goalies Save Percentage, 2009-2014", "Goaltenders",
               "Save Percentage", ('black', 'gold'), (12, 8), 0,
               "save_percent.png", True, [80, 95])
    gaa = getDataFrame(pensPlayoffdf, pensRegulardf, 'GAA', False)
    plotFigure(gaa, "bar", "Penguins Goalies Goals Against Average, 2009-2014",
               "Goaltenders", "Goals Against Average (GAA)", ('black', 'gold'),
               (12, 8), 0, "gaa.png", False, [0, 0])
    spg = getDataFrame(pensPlayoffdf, pensRegulardf, 'SPG', False)
    plotFigure(spg, "bar", "Penguins Goalies Shots Faced Per Game, 2009-2014",
               "Goaltenders", "Shots Faced Per Game", ('black', 'gold'),
               (12, 8), 0, "spg.png", False, [0, 0])
    winners = (('2009', 'Fleury', 'PIT'), ('2010', 'Niemi', 'CHI'),
               ('2011', 'Thomas', 'BOS'), ('2012', 'Quick', 'LAK'),
               ('2013', 'Crawford', 'CHI'), ('2014', 'Lundqvist',
                                             'NYR'), ('2014', 'Quick', 'LAK'))
    winnerShots = pd.Series(np.array([
        playoffsdf.iloc[i]['SPG'] for i in range(len(playoffsdf))
        if (str(playoffsdf.iloc[i]['Year']), playoffsdf.iloc[i]['Player'],
            playoffsdf.iloc[i]['Tm']) in winners
    ]),
                            index=np.array(
                                ('Fleury 2009', 'Niemi 2010', 'Thomas 2011',
                                 'Quick 2012', 'Crawford 2013',
                                 'Lundqvist 2014', 'Quick 2014')))
    plotFigure(winnerShots, "bar",
               "Stanley Cup Winning Goalies Shots Faced Per Game, 2009-2014",
               "Goaltenders", "Shots Faced Per Game", ('gold'), (12, 8), 0,
               "winnersSPG.png", False, [0, 0])
    idx = createIndex(playoffsdf)
    goalieStatsdf = playoffsdf[['SV%', 'GAA']]
    clusterList = clusterGoalies(goalieStatsdf, idx, 10)
    for num, cluster in enumerate(clusterList):
        print "Cluster%s: %s" % (num + 1, ", ".join(cluster))
예제 #2
0
def main():
	playoffsdf = pd.read_csv("Goaltending_playoffs.csv", sep=',')
	playoffsdf = modifydf(playoffsdf, True)
	regulardf = pd.read_csv("Goaltending_regularSeason.csv", sep=',')
	regulardf.rename(columns={'Season': 'Year'}, inplace=True)
	regulardf = modifydf(regulardf, False)
	pensPlayoffdf = playoffsdf[(playoffsdf.Tm == 'PIT')]
	pensRegulardf = regulardf[(regulardf.Tm == 'PIT')]
	savePercent = getDataFrame(pensPlayoffdf, pensRegulardf, 'SV%', True)
	plotFigure(savePercent, "bar", "Penguins Goalies Save Percentage, 2009-2014", "Goaltenders", "Save Percentage", ('black', 'gold'), (12, 8), 0, "save_percent.png", True, [80, 95])
	gaa = getDataFrame(pensPlayoffdf, pensRegulardf, 'GAA', False)
	plotFigure(gaa, "bar", "Penguins Goalies Goals Against Average, 2009-2014", "Goaltenders", "Goals Against Average (GAA)", ('black', 'gold'), (12, 8), 0, "gaa.png", False, [0, 0])
	spg = getDataFrame(pensPlayoffdf, pensRegulardf, 'SPG', False)
	plotFigure(spg, "bar", "Penguins Goalies Shots Faced Per Game, 2009-2014", "Goaltenders", "Shots Faced Per Game", ('black', 'gold'), (12, 8), 0, "spg.png", False, [0, 0])
	winners = (('2009', 'Fleury', 'PIT'), ('2010', 'Niemi', 'CHI'), ('2011', 'Thomas', 'BOS'), ('2012', 'Quick', 'LAK'), ('2013', 'Crawford', 'CHI'), ('2014', 'Lundqvist', 'NYR'), ('2014', 'Quick', 'LAK'))
	winnerShots = pd.Series(np.array([playoffsdf.iloc[i]['SPG'] for i in range(len(playoffsdf)) if(str(playoffsdf.iloc[i]['Year']), playoffsdf.iloc[i]['Player'], playoffsdf.iloc[i]['Tm']) in winners]), index=np.array(('Fleury 2009', 'Niemi 2010', 'Thomas 2011', 'Quick 2012', 'Crawford 2013', 'Lundqvist 2014', 'Quick 2014')))
	plotFigure(winnerShots, "bar", "Stanley Cup Winning Goalies Shots Faced Per Game, 2009-2014", "Goaltenders", "Shots Faced Per Game", ('gold'), (12, 8), 0, "winnersSPG.png", False, [0,0])
	idx = createIndex(playoffsdf)
	goalieStatsdf = playoffsdf[['SV%', 'GAA']]
	clusterList = clusterGoalies(goalieStatsdf, idx, 10)
	for num, cluster in enumerate(clusterList):
		print "Cluster%s: %s" % (num+1, ", ".join(cluster))
예제 #3
0
def main():
	finalsdf = pd.read_csv("finalsData.csv", sep=',')
	statsdf = createPlotdf(finalsdf, ['Goals', 'Corsi', 'Fenwick', 'Shots', 'Penalties'], True)
	plotFigure(statsdf, "bar", "Key Stats for 2014 Stanley Cup Finals", "Statistics", "Percentage", ('purple', 'blue'), (12, 8), 0, "finals_stats.png", True, [0, 70])
	savesdf = createPlotdf(finalsdf, ['SV%',], False)
	plotFigure(savesdf, "bar", "Save Percentage for 2014 Stanley Cup Finals", "Teams", "Percentage", ('purple', 'blue'), (8, 8), 0, "save_percent.png", True, [90, 95])