Skip to content

Instantly share code, notes, and snippets.

@jes-moore
Created December 22, 2018 19:28
Show Gist options
  • Save jes-moore/d1cb7f5bf0426a3bcfe6f6c508a869a3 to your computer and use it in GitHub Desktop.
Save jes-moore/d1cb7f5bf0426a3bcfe6f6c508a869a3 to your computer and use it in GitHub Desktop.
reb_goals = shot_df_agg2.loc[shot_df_agg2.shotTimeDiff <= 3, 'numGoals'].sum()
reb_shots = shot_df_agg2.loc[shot_df_agg2.shotTimeDiff <= 3, 'numShots'].sum()
norm_goals = shot_df_agg2.loc[shot_df_agg2.shotTimeDiff > 3, 'numGoals'].sum()
norm_shots = shot_df_agg2.loc[shot_df_agg2.shotTimeDiff > 3, 'numShots'].sum()
## Data
data = go.Bar(
x=['Shots', 'Goals'],
y=[reb_shots / norm_shots, reb_goals / norm_goals],
name='Goal Count')
## Layout
layout = go.Layout(
title='Rebound as a Proportion of Total (Shots and Goals)',
height=400,
width=800)
#Fig and Plot
fig = go.Figure(data=[data], layout=layout)
iplot(fig)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment