Last active
December 5, 2020 23:14
-
-
Save thepycoach/aef04ea2800f15d3c9f3c213f8c1f4e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #3,Finding Surebets | |
| #Formula to find surebets | |
| def find_surebet(frame): | |
| frame[['btts_x_1', 'btts_x_2']] = frame['btts_x'].apply(lambda x: x.split('\n')).apply(pd.Series).astype(float) | |
| frame[['btts_y_1', 'btts_y_2']] = frame['btts_y'].apply(lambda x: x.split('\n')).apply(pd.Series).astype(float) | |
| frame['sure_btts1'] = (1 / frame['btts_x_1']) + (1 / frame['btts_y_2']) | |
| frame['sure_btts2'] = (1 / frame['btts_x_2']) + (1 / frame['btts_y_1']) | |
| frame = frame[['Teams_x', 'btts_x', 'Teams_y', 'btts_y', 'sure_btts1', 'sure_btts2']] | |
| frame = frame[(frame['sure_btts1'] < 1) | (frame['sure_btts2'] < 1)] | |
| frame.reset_index(drop=True, inplace=True) | |
| return frame | |
| #applying formula | |
| df_surebet_tipico_bwin = find_surebet(df_surebet_tipico_bwin) | |
| df_surebet_tipico_betfair = find_surebet(df_surebet_tipico_betfair) | |
| df_surebet_bwin_betfair = find_surebet(df_surebet_bwin_betfair) | |
| #creating dictionary | |
| dict_surebet = {'Tipico-Bwin':df_surebet_tipico_bwin, 'Tipico-Betfair':df_surebet_tipico_betfair, 'Bwin-Betfair':df_surebet_bwin_betfair} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment