title: Edit column values based on other column values
body: <p>I have a <code>pandas.DataFrame</code> that I need to update based on values in a couple of columns with values from the columns where needed. NAME is named something else as I know that is bad practice. It is just for the example.</p>
  
  <p>Here is a sample of what I am working with:</p>
  
  <pre><code>import re
  import pandas as pd
  
  def anydigit(text):
      find_digit = re.search(r'\d+', text)
      if find_digit:
          return find_digit.start()
      else:
          return 0
  
  df = pd.DataFrame({'DPID': ['A1', 'A2'], 'NAME': ['John Doe', 'Jane Doe'],
                     'ADDR_1': ['123 MAIN ST', 'ATTN: JOHN DOE'], 'ADDR_2': ['', 'P O BOX 123456']})
  df['addr_ad1'] = df['ADDR_1'].apply(anydigit)
  df['addr_ad2'] = df['ADDR_2'].apply(anydigit)
  df['AUX_ADDR_LINE'] = ''
  </code></pre>
  
  <p>This is what needs to happen.</p>
  
  <pre><code>If addr_ad1 == 0 and addr_ad2 &gt; 0:
      aux_addr_line = addr_1
      addr_1 = addr_2
      addr_2 = ''
  elfif addr_ad1 &gt; 0 and re.sub(r'\s+', '', addr_2)[:4] == 'POBOX':
      aux_addr_line = ''
      addr_1 = addr_1
      addr_2 = ''
  elif addr_ad2 &gt; 0 and re.sub(r'\s+', '', addr_1)[:4] == 'POBOX':
      aux_addr_line = ''
      addr_1 = addr_2
      addr_2 = ''
  </code></pre>
  
  <p>I would think that <code>.apply()</code> would work, but not sure how I would write that.</p>