So I'm working with a baseball dataset, that has 2 rows for each game (one row for home team one row for away team). The step in the project that I'm stuck on is trying to create a new column that computes either a "1" or a "0" for each game based on the pred_era. Meaning for each Game.ID, if the pred_era is greater then the other pred_era, the 3rd column would be a "0" for losing otherwise it would be a "1" for winning. I assume a for loop would be the correct approach? But I'm getting stuck. Can anyone help?

So ideally the new column would have a "1" for the first row (pred_era = 3.627) and a "0" for the 2nd row (pred_era = 6.96). Then the 3rd row would have a "1" with the 4th row having a "0" and so on.