I am trying to achieve the following using python pandas but not able to figure out why it's not working. I have searched extensively in the web but desired outcome unable to find.
Data is as follows
Data ADJ_LOW_1 ADJ_LOW_2 MIN ADJ_HIGH_1 ADJ_HIGH_1 MAX
Data1 34.155 33.81 33.3 36.865 36.865 36.9
Data2 15.444 15.288 15.9 15.756 15.756 17.25
Data3 2.3265 2.303 2.35 2.4745 2.4745 2.6
Data4 21938.4 21716.8 21242 22624 22624 22600
Data5 6.5835 6.517 6.25 6.8175 6.8175 7.45
Data6 196.02 194.04 192.15 218.16 218.16 214.4
Data7 109.395 108.29 107.95 126.654 126.654 113.6
Data8 7.7715 7.693 7.5 8.383 8.383 8.25
Data9 604.89 598.78 572 640.3905 640.3905 648.9
Data10 843.5295 835.009 829 871.327 871.327 924.25
data type is
ADJ_LOW_1 float64
ADJ_LOW_2 float64
MIN float64
ADJ_HIGH_1 float64
ADJ_HIGH_1 float64
MAX float64
dtype: object
my objective is to achieve the following outcome:
if ADJ_LOW_1 <= MIN & ADJ_HIGH_1 >= MAX then insert column 'Result' and put value "P1"
elif
if ADJ_LOW_2<= MIN & ADJ_HIGH_1 >= MAX then insert column 'Result' and put value "P2"
elif
if ADJ_LOW_1<= MIN & ADJ_HIGH_2 >= MAX then insert column 'Result' and put value "P3"
esle
"Blank"
``
x is the data reference
`x.ADJ_LOW_1<=x.MIN & x.ADJ_HIGH_1>=x.MAX: x['R']="P1" elif x.ADJ_LOW_2<=x.MIN & x.ADJ_HIGH_1>=x.MAX: x['R']="P2" elif x.ADJ_LOW_1<=x.MIN & x.ADJ_HIGH_2>=x.MAX: x['R']="P3" else: x['R']=" "`