Skip to content

Commit

Permalink
feat: id column is added to appended dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
taglitis committed Oct 23, 2018
1 parent 6e7fbae commit 9de0030
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions function_soccer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def db_work(goals_home_vs_away):
return countries, goals_home_vs_away

def append_home_away_goals(goals_home_vs_away):
home_goals = goals_home_vs_away[['year', 'country_name','home_team','home_team_goal']]
away_goals = goals_home_vs_away[['year', 'country_name','away_team','away_team_goal']]
home_goals.rename(columns={'home_team' : 'team', 'home_team_goal' : 'total_goals'}, inplace = True)
away_goals.rename(columns={'away_team' : 'team', 'away_team_goal' : 'total_goals'}, inplace = True)
home_goals = goals_home_vs_away[['year', 'country_name','home_team','home_team_goal', 'home_id']]
away_goals = goals_home_vs_away[['year', 'country_name','away_team','away_team_goal', 'away_id']]
home_goals.rename(columns={'home_team' : 'team', 'home_team_goal' : 'total_goals', 'home_id' : 'id'}, inplace = True)
away_goals.rename(columns={'away_team' : 'team', 'away_team_goal' : 'total_goals', 'away_id' : 'id'}, inplace = True)
#Before appending check shape
print("shape for home_away_goals: \n", home_goals.shape, " and away_goals: \n", away_goals.shape)
home_away_goals = home_goals.append(away_goals, ignore_index = True)
Expand Down

0 comments on commit 9de0030

Please sign in to comment.