How do I use multiple columns of a df as input to a function?
14:40 03 May 2022

I have a dataframe full of numerical values, and I want to apply a function (delta) which takes 6 arguments:

calls['delta'] = calls[['callput','underlyinglast','strike','yte','rfr','hvol90']].apply(delta,axis=1)

I keep getting this error:

TypeError: delta() missing 5 required positional arguments: 'S', 'K', 't', 'r', and 'sigma'

I also tried a variant with lambda, but I keep getting that error. I think because it's trying to apply the function to each individual value, instead of the row.

Can I do this any other way? (without iterrows, it's so slow, it's a df with 500k rows)

python pandas apply