Given a function
that takes multiple arguments and returns multiple values as so:
def tuple_unpack(value, another_value):
''' does some interesting stuff ... '''
return value, another_value
Is there a way to apply such function to a pandas
dataframe
where for the 2 function arguments I can pass values from 2 columns, then unpack the output tuple on multiple colums as so:
df[['value_col','another_value_col']] = df.apply(lambda df.col, df.col: tuple_unpack)
You can using
concat
, with dataframe constructor