I am new to python pandas. I build a small function and now I always get the following error:
The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I know that this error was already discussed in other question, however I do not really get what I should do different and how the error occurred.
So this is my simple function:
def relativeWinner():
if df['GoldSummer'] >0 & df['GoldWinter'] >0:
df['diff'] = abs(df['GoldSummer'] - df['GoldWinter'])/(df['GoldSummer'] + df['GoldWinter'])
return df['diff'].idxmax()
Can anyone tell me whats wrong here and how i would fix it?