title: Create column based on another column value, based on assigning value to sets of string values from the input column
body: <p>My problem seems like it must have a simple solution, but I am unable to solve it. I've tried <code>.loc</code> , <code>np.where</code> and <code>df.apply</code>. </p>
  
  <pre><code>#input          
  datetime        dty dtx     status
  2018-09-16 04:38:17 0.0 0.099854    F-On
  2018-09-16 04:38:18 0.0 0.100098    F-On
  2018-09-16 04:38:19 0.0 0.000000    S-On
  2018-09-16 04:38:20 0.0 0.100098    F-On
  2018-09-16 04:38:21 0.0 0.100098    circ    
  2018-09-16 04:38:22 0.0 0.100098    circInS
  2018-09-16 04:38:21 0.0 0.100098    TH
  2018-09-16 04:38:21 0.0 0.100098    R
  2018-09-16 04:38:21 0.0 0.100098    S
  </code></pre>
  
  <p>'mapping' exists from domain -</p>
  
  <pre><code>    (F-On,S-On) becomes 'On'
      (circ,TH,circInS) becomes 'fooON'
      (R) stays 'R'
      (S) stays 'S'
  
  #expected ouput         
  datetime        dty dtx     status grouped_status               
  2018-09-16 04:38:17 0.0 0.099854    F-On    On
  2018-09-16 04:38:18 0.0 0.100098    F-On    On
  2018-09-16 04:38:19 0.0 0.000000    S-On    On
  2018-09-16 04:38:20 0.0 0.100098    F-On    On
  2018-09-16 04:38:21 0.0 0.100098    circ    fooON
  2018-09-16 04:38:22 0.0 0.100098    circInS fooON
  2018-09-16 04:38:21 0.0 0.100098    TH  fooON
  2018-09-16 04:38:21 0.0 0.100098    R   R
  2018-09-16 04:38:21 0.0 0.100098    S   S
  </code></pre>
  
  <blockquote>
    <p><code>The truth value of a Series is ambiguous. Use a.empty, a.bool(),
    a.item(), a.any() or a.all().</code></p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/questions/36921951/truth-value-of-a-series-is-ambiguous-use-a-empty-a-bool-a-item-a-any-o">I understand the code below is comparing an array to a single value</a>;
  Which is ambigious, hence it fails. To compare row wise I tried using <code>df.apply</code>, but it is not giving desired output.</p>
  
  <p>How do I make all three of the methods below work if possible, and which is the best way for a row-wise operation?</p>
  
  <pre><code>#using np.where
  df['grouped_status'] = np.where(df['status'] in ('circ','TH','circInS'), 'fooON', df['status'])
  
  #using df.loc
  df.loc[df['status'] in ('circ','TH','circInS'),['status']] = 'fooON'
  df['grouped_status'] = df['status']
  
  #function for df.apply
  def group_status_fn (row):  
  
      val = ""
  
      if row['grouped_status'] in ('F-On','B-On','S-On'):
          row['grouped_status'] = 'On'
      elif row['grouped_status'] in (circ,TH,circInS):
          row['grouped_status'] = fooON
  
      elif row['grouped_status'] == 'R':
          val = 'R'
      elif row['grouped_status'] == 'S':
          val = 'S'
  
      return val
  
  #using df.apply
  df["grouped_status2"]=df.apply(group_status_fn, axis = 1)
  
  #out - output column half empty
  datetime        dHD     status grouped_status grouped_status2               
  
  2018-09-16 04:38:35 0.000000    F-On    F-On    
  2018-09-16 04:38:36 0.000000    F-On    F-On    
  2018-09-16 04:38:37 0.000000    S-On    S-On    
  2018-09-16 04:38:38 0.000000    S-On    S-On    
  2018-09-16 04:38:39 0.000000    R   R   R
  2018-09-16 04:38:40 0.099854    R   R   R
  2018-09-16 04:38:41 0.100098    R   R   R
  2018-09-16 04:38:42 0.000000    R   R   R
  2018-09-16 04:38:43 0.000000    R   R   R
  </code></pre>