Hello and thank in advance for reading this.
I have a dataframe on which I would like to compare two quantities x and y
def test(x,y) :
if x == y :
return (x,0)
elif (x > y) :
off = x - y
on = x - off
return (on, off)
else :
off = y - x
on = y - off
return (on, off)
but when I want to apply it to my dataframe
df.apply(lambda x : test(df["quantite_1"], df["quantite_2"]), axis =1)
I have this
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
I understand that something's wrong with the parameters of my function, but I can't tell what. Could someone help me?