I have df that currently has two columns df[['sys1','dia1']]
I created this function (the parameters are d= df['dia1'] and s = df['sys1'] :
Now i am trying to create a third column by using this function. It would look like this:
df['FirstVisitStge'] = df['FirstVisitStge'].apply(classify)
I am getting an error. I even tried using predefined parameters in the function and still getting an error. What am i doing wrong?
def classify(d,s):
if (d>=90 & d<100 & s<160) or (s >= 140 & s < 160 & d < 100):
return 'Stage 1'
elif (s >= 160 & s <180 & d <110) or (d >= 100 and d < 110 and s > 180):
return 'Stage 2'
elif s >= 180 or d >= 110:
return 'hypertensive crisis'
else:
return 'NA'