df['c'] = df.apply(lambda row: 1 if row['a'] < 0 and row['b'] > 0 else 0, axis=1)
apply 是一个好方法.
df['c'] = df.apply(lambda row: 1 if row['a'] < 0 and row['b'] > 0 else 0, axis=1)
apply 是一个好方法.
转载于:https://www.cnblogs.com/qingyuanjushi/p/10239752.html