Skip to content

Instantly share code, notes, and snippets.

@thepycoach
Last active February 11, 2021 19:20
Show Gist options
  • Select an option

  • Save thepycoach/be8675c8241c68e23504cafc774a5740 to your computer and use it in GitHub Desktop.

Select an option

Save thepycoach/be8675c8241c68e23504cafc774a5740 to your computer and use it in GitHub Desktop.
#picking columns
df_system = df_filters[['home_team', 'away_team', 'goals', 'shorts_target', 'corners',
'real_odds_over', 'over2.5', 'real_odds_btts', 'btts']]
#renaming columns
df_system.rename(columns={'shorts_target':'SoT', 'corners':'C', 'goals':'G', 'over2.5':'OVER',
'btts':'BTTS', 'real_odds_over':'RO_OVER', 'real_odds_btts':'RO_BTTS'}, inplace=True)
#extracting over2.5 and btts=True values
df_system = df_system.assign(OVER = df_system['OVER'].str.extract(r'(.+)\n.+').astype(float))
df_system = df_system.assign(BTTS = df_system['BTTS'].str.extract(r'(.+)\n.+').astype(float))
#calculating value of bets
df_system['V_OVER'] = df_system['OVER'] - df_system['RO_OVER']
df_system['V_BTTS'] = df_system['BTTS'] - df_system['RO_BTTS']
#sorting matches by value
df_system.sort_values('V_OVER', ascending=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment