I'm very new to python and still learning. I really appreciate any help you can provide. I have five columns in my data frame. I'd like to compare S1 to S2, then, based on several conditions, add a column with string values that represent how each sample ID has changed.
Id S1   Cat_1  S2   Cat2
25  3   Acq     4   Acq
15  9   Chp     9   Chp
22  4   Acq     5   Frn
34  4   Acq     1   Acq
45  3   Acq     9   Chp
I did this so far, but can't figure out how to add more criteria.
df['new column'] = np.where(df['S2']>df['S1'],'More','no')
What I would like is:
if ['S2']>['S1'] = 'More' 
   OR
if ['S2']<['S1'] = 'Less' 
   OR
if ['S2']=['S1'] = 'Same' 
  OR
if none of the above conditions are true, or if S1 is nan, new column value = 'New'
The result should look like this:
Id  S1  Cat_1  S2   Cat2  New_column
25  3   Acq     4   Acq    More
15  9   Chp     9   Chp    Same  
22  4   Acq     5   Frn    More  
34  4   Acq     1   Acq    Less
45  3   Acq     9   Chp    More
01              9   Chp    New 
Thanks
 
    