I'm analyzing the international football dataset to get practice on my python and data analysis knowledge it contains a column for home scores and a column for away scores and I want another column to display the winning team name. I want to fill the winner_id column based on the winning criteria. When I write the code as follows it fills it correctly:
results['winner_id'] = results.loc[results['home_score'] > results['away_score'],'home_team']
When I add the next code with the next winning criteria, it deletes all previous values:
results['winner_id'] = results.loc[results['home_score'] > results['away_score'],'home_team']
results['winner_id'] = results.loc[results['home_score'] < results['away_score'],'away_team']
I made these steps before without any problem. Is there any thing I did it wrong for this piece of code
I expecting to find a solution or a suggestion to fix the above problem