There are my code and dataframe: dataframe
I am trying to receive signal from the dataframe and return 1,-1,0. For example: If the dataframe show that the latest signal columns is 1, then return 1
Then a problem popped up ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
def signal_copyer(signal):
if signal>0:
return 1
if signal<0:
return -1
else:
return 0