title: Pandas left join in place
body: <p>I have a large data frame <code>df</code> and a small data frame <code>df_right</code> with 2 columns <code>a</code> and <code>b</code>. I want to do a simple left join / lookup on <code>a</code> without copying <code>df</code>.</p>
  
  <p>I come up with this code but I am not sure how robust it is:</p>
  
  <pre><code>dtmp = pd.merge(df[['a']], df_right, on = 'a', how = "left")  #one col left join
  df['b'] = dtmp['b'].values
  </code></pre>
  
  <p>I know it certainly fails when there are duplicated keys: <a href="https://stackoverflow.com/questions/40002355/pandas-left-join-why-more-results">pandas left join - why more results?</a></p>
  
  <p>Is there better way to do this?</p>
  
  <p>Related:</p>
  
  <p><a href="https://stackoverflow.com/questions/44937462/outer-merging-two-data-frames-in-place-in-pandas">Outer merging two data frames in place in pandas</a></p>
  
  <p><a href="https://stackoverflow.com/questions/32330490/what-are-the-exact-downsides-of-copy-false-in-dataframe-merge?noredirect=1&amp;lq=1">What are the exact downsides of copy=False in DataFrame.merge()?</a></p>