title: Python: pandas DataFrame new column based on other columns
body: <p>I have a <code>df</code> with 2 columns like below:</p>
  
  <pre class="lang-py prettyprint-override"><code>        A       B
  0  100-00     nan
  1  200-00     nan
  2   other  300-00
  3  100-00    text
  4   other     nan
  </code></pre>
  
  <p>I need to create column C which will apply logic as below:</p>
  
  <ul>
  <li>if B is nan, then A</li>
  <li>if B starts with numeric, then B</li>
  <li>else A</li>
  </ul>
  
  <p>I've got code as below, which is working just fine, but I believe there might be a better, more efficent way to do it:</p>
  
  <pre class="lang-py prettyprint-override"><code>C = []
  for r in range(df.shape[0]):
      if df['B'].iloc[r] == 'nan':
          C.append(df['A'].iloc[r])
      elif df['B'].iloc[r][:3].isnumeric():
          C.append(df['B'].iloc[r])
      else:
          C.append(df['A'].iloc[r])
  df['C'] = C
  
  df
          A       B       C
  0  100-00     nan  100-00
  1  200-00     nan  200-00
  2   other  300-00  300-00
  3  100-00    text  100-00
  4   other     nan   other
  </code></pre>
  
  <p>Thanks in advance for all your help.</p>