Att, I want to create multiple columns from lambda function\'s multiple return values in python DataFrame.
Similar with the last line of my demo code.
Is there
An alternative to using pd.Series is to turn the output into a list. You can then assign the new columns as:
pd.Series
df[['slope', 'R2']] = pd.DataFrame(df.apply(lambda x: f_polyfit(x)).tolist(), index=df.index)