更新时间:2023-11-21 21:05:28
一种方法是将返回值包装在 pd.Series
中以便分配
One way would be to wrap the return value in pd.Series
in order to assign to new dataframe columns.
g = lambda x: pd.Series(f_polyfit(x.y1, x.y2, x.y3, x.y5, x.y5, degree=1))
df[['slope', 'R2']] = df.apply(g, axis=1)