📅  最后修改于: 2022-03-11 14:47:02.536000             🧑  作者: Mango
mask0 = (df['condition'] == 1)
mask1 = (df['condition'] == 0)
df.loc[mask0, 'newColumn'] = df.loc[mask0, 'otherColumn1']
df.loc[mask1, 'newColumn'] = df.loc[mask1, 'otherColumn2']