This my dataframe.
I would like to create a new varaible that equals to one if my 'Y' variable is between two values in my dataframe above (UP, DOWN).
I've tried many codes however, no satisfying results. These are the codes i've tried;
first one :
A['DM'] = ((A.Y >A['UP']) & (A.Y <A['DOWN'])).astype(int)
second one :A['DM']=1 if [(A['Y'] > A['DOWN']) & (A['Y'] < A['UP'])]