title: Fill a dataframe using a reference/lookup dataframe
body: <p>I would like to fill one dataframe (df) with information from a lookup dataframe(reference_df). I have tried this (using other StackOverflow posts and answers) with merge, fillna and combine_first. However, each method brings some problems in my case.</p>
  <p>df1:</p>
  <pre><code>  class  A   B   C
  0     a  1 NaN NaN
  1     b  2 NaN NaN
  2     c  3 NaN NaN
  3     a  1 NaN NaN
  </code></pre>
  <p>reference_df:</p>
  <pre><code>  class  A  B  C
  0     a  1  2  3
  1     b  2  4  6
  </code></pre>
  <p>Target_df:</p>
  <pre><code>  class  A    B    C
  0     a  1  2.0  3.0
  1     b  2  4.0  6.0
  2     c  3  NaN  NaN
  3     a  1  2.0  3.0
  </code></pre>
  <p>Three things to note:</p>
  <ul>
  <li>'c' is not in the reference_df so should remain empty</li>
  <li>'a' appears twice not ordered in df1, and should be filled with the values of 'a' in reference_df</li>
  <li>the order of df1 should stay as is</li>
  </ul>
  <p>The above also show the issues I ran into with merging and fillna and combine_first. The repetition of 'a' breaks fillna and is filled with other values in the other two methods.</p>
  <p>The solution I have going now is done manually via looping over both frames, but this is very expensive and the dataset is very large.</p>
  <p>I hope I am explaining this alright, first post on StackOverflow so I might be missing some needed information. Let me know if I should clarify.</p>
  <p>Cheers</p>