答案 0 :(得分:1)
如果您的数据按如下所示排序:
df['Win'] = (df['Total'].iloc[::2]
.gt(df['Total'].iloc[1::2].values)
.astype(float)
)
df['Win'] = df['Win'].fillna(1-df['Win'].shift())
输出:
Game Total Win
0 1 107 1.0
1 1 97 0.0
2 2 90 1.0
3 2 77 0.0
4 3 111 1.0
5 3 103 0.0