更新时间:2022-11-22 22:21:19
Adding pd.Series
df[['sum', 'difference']] = df.apply(
lambda row: pd.Series(add_subtract(row['a'], row['b'])), axis=1)
df
收益
a b sum difference
0 1 4 5 -3
1 2 5 7 -3
2 3 6 9 -3