Mar-10-2021, 09:41 PM
Hello,
I am trying to write a function that includes an IF statement that looks at two columns in the dataframe to highlight the dates when the 'value' is higher than the 'trend':
Any help is appreciated.
Matt
I am trying to write a function that includes an IF statement that looks at two columns in the dataframe to highlight the dates when the 'value' is higher than the 'trend':
def arrow(trend, close):
signal = []
for date, value in close.iteritems():
if value > trend:
signal.append(value*1.05)
else:
signal.append(np.nan)
return signalbut I keep getting this message:Error:ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().I tried using the suggestions provided by the error but can't get it to work.Any help is appreciated.
Matt
