title: Pandas fillna using groupby
body: <p>I am trying to impute/fill values using rows with similar columns' values.</p>
  <p>For example, I have this dataframe:</p>
  <pre><code>one | two | three
  1      1     10
  1      1     nan
  1      1     nan
  1      2     nan
  1      2     20
  1      2     nan
  1      3     nan
  1      3     nan
  </code></pre>
  <p>I wanted to using the keys of column <code>one</code> and <code>two</code> which is similar and if column <code>three</code> is not entirely nan then impute the existing value from a row of similar keys with value in column '3'.</p>
  <p>Here is my desired result:</p>
  <pre><code>one | two | three
  1      1     10
  1      1     10
  1      1     10
  1      2     20
  1      2     20
  1      2     20
  1      3     nan
  1      3     nan
  </code></pre>
  <p>You can see that keys 1 and 3 do not contain any value because the existing value does not exists.</p>
  <p>I have tried using <code>groupby</code>+<code>fillna()</code>:</p>
  <pre><code>df['three'] = df.groupby(['one','two'])['three'].fillna()
  </code></pre>
  <p>which gave me an error.</p>
  <p>I have tried forward fill which give me rather strange result where it forward fill the column 2 instead. I am using this code for forward fill.</p>
  <pre><code>df['three'] = df.groupby(['one','two'], sort=False)['three'].ffill()
  </code></pre>