title: Data Manipulation - Get data from another column if `nan`
body: <p>I have a Pandas DataFrame of 23 columns and 1119 rows.</p>
  
  <p>Here is the issue, columns 13, 14, 20 and 21 are of float dtype.</p>
  
  <p>If data in column 13 and 14 is <code>nan</code>, then they are present in 20 and 21, and vice versa.</p>
  
  <p>I want to create a column, if value is missing, get from the other.</p>
  
  <p>Example: column 13 and 14 is <code>nan</code> then get value from 20 and 21.</p>
  
  <p>Here is what I came up with, I created a function and iterated using itertuples</p>
  
  <pre><code>def AP_calc(df):
      for i in df.itertuples():
          if i[20]==np.nan &amp; i[21]==np.nan:
             pool = i[13] + i[14]
          else:
              pool = i[20] + i[21]
          return pool
  </code></pre>
  
  <p>then used an apply function but this does not work. </p>
  
  <pre><code>df["test"] = df[['AP in %','AP_M in %','FixP in €','FixP C in €']].apply(AP_calc,axis=1)
  </code></pre>
  
  <p>I have tried other methods too but not working, please help me out, please</p>