I have a function (hypothetical):
def example_fct(x,y)
return x*y
I want to apply this function into a hypothetical dataframe:
df =
number1 number2
0 20 30
1 25 10
Where it will result as:
number1 number2 multiply
0 20 30 600
1 25 10 250
I tried to use apply:
df_['multiply'] = example_fct(df.number1,df.number2)
But this does not work as the function arguments are scalar instead of series. I can always use .apply for a function that has single input argument, but this function uses 2 input arguments.
Furthermore, I am also wondering if this function can be used with series from different data frames (but both data frames have the same length).
df.number1.mul(df.number2)ornp.multiply(df.number1, df.number2)