import pandas as pd
d = {'a': [1,2,3],
'b': [3,4,5],
'c': [5,4,3]}
df=pd.DataFrame(d)
df
returns:
a b c
0 1 3 5
1 2 4 4
2 3 5 3
I create the following function to calculate m:
def foo(x,y,z):
m=x(y+z)
return m
Then apply it to df:
df['new']=df[['a', 'b', 'c']].apply(lambda x,y,z: foo(x,y,z))
but this gives following error:
("<lambda>() missing 2 required positional arguments: 'y' and 'z'", 'occurred at index a')
How can i solve it?