title: calculating differences within groups
body: <p>I have a <code>DataFrame</code> whose rows provide a value of one feature at one time. Times are identified by the time column (there's about 1000000 distinct times). Features are identified by the feature column (there's a few dozen features). There's at most one row for any combination of feature and time. At each time, only some of the features are available; the only exception is feature 0 which is available at all times. I'd like to add to that <code>DataFrame</code> a column that shows the value of the feature 0 at that time. Is there a reasonably fast way to do it?</p>
  
  <p>For example, let's say I have</p>
  
  <pre><code>df = pd.DataFrame({
    'time': [1,1,2,2,2,3,3],
    'feature': [1,0,0,2,4,3,0],
    'value':[1,2,3,4,5,6,7],
  })
  </code></pre>
  
  <p>I want to add a column that contains [2,2,3,3,3,7,7].</p>
  
  <p>I tried to use <code>groupby</code> and boolean indexing but no luck.</p>