title: Merge two rows in pandas if None or nan
body: <p>For a given data frame <code>df</code> </p>
  
  <pre><code>df = pd.DataFrame({
      'id': [1, 2, 2], 
      'name': ['Peter', 'Max', None], 
      'age': [50.0, np.nan, 60.0]
  })
  </code></pre>
  
  <p>I want to <code>groupby</code> and combine the data if there is just a <code>None</code> or <code>nan</code> in the column of the grouped row, so that the resulting df should look like</p>
  
  <pre><code>        age     id  name
  id              
  1   0   50.0    1   Peter
  2   1   60.0    2   Max
  </code></pre>
  
  <p>Is there a neat solution better than this mine:</p>
  
  <pre><code>def f(df):
      names = set(df['name']) - {None}
      if len(names) == 1:
          df['name'] = names.pop()
      else:
          print('Error: Names are not mergeable:', names)
  
      ages = {age for age in df['age'] if ~np.isnan(age)}
      if len(ages) == 1:
          df['age'] = ages.pop()
      else:
          print('Error: Ages are not mergeable:', ages)
  
      df = df.drop_duplicates()
      return df
  
  df.groupby('id').apply(f)
  </code></pre>