If I have a function which supports variable argument number, i.e. uses *args, how can I populate the arguments from a loop/list comprehension? Say the function expects multiple lists as arguments and I have a table/dataframe and want to use each column as an input argument, why does this not work?
funName([df[iCol].values for iCol in df.columns])
Say my dataframe has 5 columns, I would be required to call the function like so:
funName(col1, col2, col3, col4, col5)
But I do not want to manually create variables for each column but rather populate the argument list dynamically. Thanks.