I have a pandas dataframe 'df' with two columns 'A' and 'B', I have a function with two arguments
def myfunction(B, A):
# do something here to get the result
return result
and I would like to apply it row-by-row to df using the 'apply' function
df['C'] = df['B'].apply(myfunction, args=(df['A'],))
but I get the error
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
whats happening here, it seems it takes df['A'] as the whole series! not just the row entry from that series as required.