title: Fill in missing pandas data with previous non-missing value, grouped by key
body: <p>I am dealing with pandas DataFrames like this:</p>
  
  <pre><code>   id    x
  0   1   10
  1   1   20
  2   2  100
  3   2  200
  4   1  NaN
  5   2  NaN
  6   1  300
  7   1  NaN
  </code></pre>
  
  <p>I would like to replace each NAN 'x' with the previous non-NAN 'x' from a row with the same 'id' value:</p>
  
  <pre><code>   id    x
  0   1   10
  1   1   20
  2   2  100
  3   2  200
  4   1   20
  5   2  200
  6   1  300
  7   1  300
  </code></pre>
  
  <p>Is there some slick way to do this without manually looping over rows?</p>