def goals_against(pbp): "Aggregate goals against for individual goalies over the input set of pbp. Returns a series indexed by goalie text_id." goal = evfilter.goals(pbp) goalies = pd.Series(data=goal['Home_Goalie'], index=goal.index) goalies[goal['Ev_Team'] == goal['Home_Team']] = goal['Away_Goalie'] return goalies.dropna().value_counts().sort_index()
def players_assists(pbp): goal = evfilter.goals(pbp) players_assists = pd.melt(goal[['p2_name', 'p3_name']]).dropna().groupby('value').size() players_assists.index.name = 'player' return players_assists
def team_goals(pbp): goal = evfilter.goals(pbp) team_goals = goal.groupby('Ev_Team').size() team_goals.index.name = 'Ev_Team' return team_goals
def players_goals(pbp): goal = evfilter.goals(pbp) players_goals = goal.groupby('p1_name').size() players_goals.index.name = 'player' return players_goals