title: New column with a value inside a group
body: <pre><code>       A           B    C
  0    Red  2002-01-13  3.9
  1    Red  2002-01-13  4.1
  2    Red  2002-01-13  2.3
  3    Red  2002-01-14  0.7
  4    Red  2002-01-14  5.9
  5    Red  2002-01-14  3.0
  6    Red  2002-01-15  6.9
  7    Red  2002-01-15  6.4
  8    Red  2002-01-15  9.9
  9   Blue  2006-07-21  7.2
  10  Blue  2006-07-21  4.2
  11  Blue  2006-07-21  6.1
  12  Blue  2006-07-22  0.1
  13  Blue  2006-07-22  3.2
  14  Blue  2006-07-22  2.7
  </code></pre>
  
  <p>I want to create a <code>df['D']</code> column, with next condition:</p>
  
  <ul>
  <li>Take the last <code>C</code> value of the first <code>B</code> date, by each <code>A</code> group.</li>
  </ul>
  
  <p>I mean, for <code>A</code> group <code>Red</code>, take 2.3, as it is the last <code>C</code> value of first <code>B</code> date <code>2002-01-13</code>. For <code>A</code> group <code>Blue</code>, take 6.1, as it is the last <code>C</code> value of first <code>B</code> date <code>2006-07-21</code>.</p>
  
  <p>Output should be:</p>
  
  <pre><code>       A           B    C    D
  0    Red  2002-01-13  3.9  2.3
  1    Red  2002-01-13  4.1  2.3
  2    Red  2002-01-13  2.3  2.3
  3    Red  2002-01-14  0.7  2.3
  4    Red  2002-01-14  5.9  2.3
  5    Red  2002-01-14  3.0  2.3
  6    Red  2002-01-15  6.9  2.3
  7    Red  2002-01-15  6.4  2.3
  8    Red  2002-01-15  9.9  2.3
  9   Blue  2006-07-21  7.2  6.1
  10  Blue  2006-07-21  4.2  6.1
  11  Blue  2006-07-21  6.1  6.1
  12  Blue  2006-07-22  0.1  6.1
  13  Blue  2006-07-22  3.2  6.1
  14  Blue  2006-07-22  2.7  6.1
  </code></pre>
  
  <p>I've tried:</p>
  
  <pre><code>df['D'] = df.groupby('A')["C"].transform('last')
  </code></pre>