Skip to content

Instantly share code, notes, and snippets.

@bd317
Created August 23, 2019 11:07
Show Gist options
  • Select an option

  • Save bd317/dc816362a337b6f40f3d65c5aeb2060c to your computer and use it in GitHub Desktop.

Select an option

Save bd317/dc816362a337b6f40f3d65c5aeb2060c to your computer and use it in GitHub Desktop.
def soc_loop(leaguedf,TEAM,):
leaguedf['Draws'] = 99999
for row in range(0, len(leaguedf)):
if ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')) | \
((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')):
leaguedf['Draws'].iloc[row] = 'Draw'
elif ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')) | \
((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')):
leaguedf['Draws'].iloc[row] = 'No_Draw'
else:
leaguedf['Draws'].iloc[row] = 'No_Game'
@divakar54
Copy link

What is the dataset for this code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment