title: Update column values in a group based on one row in that group
body: <p>I have a dataframe from source data that resembles the following:</p>
  <pre><code>In[1]: df = pd.DataFrame({'test_group': [1, 1, 1, 2, 2, 2, 3, 3, 3],
           'test_type': [np.nan,'memory', np.nan, np.nan, 'visual', np.nan, np.nan,
           'auditory', np.nan]}
  Out[1]:
     test_group test_type
  0           1       NaN
  1           1    memory
  2           1       NaN
  3           2       NaN
  4           2    visual
  5           2       NaN
  6           3       NaN
  7           3  auditory
  8           3       NaN
  </code></pre>
  <p><code>test_group</code> represents the grouping of the rows, which represent a test. I need to replace the NaNs in column <code>test_type</code> in each <code>test_group</code> with the value of the row that is not a NaN, e.g. memory, visual, etc.</p>
  <p>I've tried a variety of approaches including isolating the &quot;real&quot; value in <code>test_type</code> such as</p>
  <pre><code>In [4]: df.groupby('test_group')['test_type'].unique()
  Out[4]:
  test_group
  1      [nan, memory]
  2      [nan, visual]
  3    [nan, auditory]
  </code></pre>
  <p>Easy enough, I can index into each row and pluck out the value I want. This seems to head in the right direction:</p>
  <pre><code>In [6]: df.groupby('test_group')['test_type'].unique().apply(lambda x: x[1])
  Out[6]:
  test_group
  1      memory
  2      visual
  3    auditory
  </code></pre>
  <p>I tried this among many other things but it doesn't quite work (note: apply and transform give the same result):</p>
  <pre><code>In [15]: grp = df.groupby('test_group')
  In [16]: df['test_type'] = grp['test_type'].unique().transform(lambda x: x[1])
  
  In [17]: df
  Out[17]:
     test_group test_type
  0           1       NaN
  1           1    memory
  2           1    visual
  3           2  auditory
  4           2       NaN
  5           2       NaN
  6           3       NaN
  7           3       NaN
  8           3       NaN
  </code></pre>
  <p>I'm sure if I looped it I'd be done with things, but loops are too slow as the data set is millions of records per file.</p>