Skip to content

Instantly share code, notes, and snippets.

@springcoil
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save springcoil/c673b19febe0fa157880 to your computer and use it in GitHub Desktop.
Save springcoil/c673b19febe0fa157880 to your computer and use it in GitHub Desktop.
A Bayesian model for myself to debug - PyData Berlin
df_avg = pd.DataFrame({'avg_att': atts.stats()['mean'],
'avg_def': defs.stats()['mean']},
index=teams.team.values)
df_avg = pd.merge(df_avg, df_observed, left_index=True, right_on='team', how='left')
fig, ax = plt.subplots(figsize=(8,6))
for outcome in ['winner', 'triple_crown', 'wooden_spooon', '']:
ax.plot(df_avg.avg_att[df_avg.QR == outcome],
df_avg.avg_def[df_avg.QR == outcome], 'o', label=outcome)
for label, x, y in zip(df_avg.Team.values, df_avg.avg_att.values, df_avg.avg_def.values):
ax.annotate(label, xy=(x,y), xytext = (-5,5), textcoords = 'offset points')
ax.set_title('Attack vs Defense avg effect: 13-14 Six Nations')
ax.set_xlabel('Avg attack effect')
ax.set_ylabel('Avg defense effect')
ax.legend()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment