title: Modifying data frame with values from another data frame
body: <p>Assuming I've 2 data frames, <code>df_a</code> and <code>df_b</code> as below:</p>
  
  <pre><code>import pandas as pd
  </code></pre>
  
  <p>df_a</p>
  
  <pre><code>df_a = pd.DataFrame({"Letters": ['E', 'H', 'O', 'N', 'M', 'K', 'T', 'X'],
                       "Greek":['epsilon', 'eta', 'omicron', 'nu', 'mu', 
                                'kappa', 'tau', 'chi']})
  
       Greek Letters
  0  epsilon       E
  1      eta       H
  2  omicron       O
  3       nu       N
  4       mu       M
  5    kappa       K
  6      tau       T
  7      chi       X
  </code></pre>
  
  <p>df_b</p>
  
  <pre><code>df_b = pd.DataFrame({"Letters": ['Y', 'E', 'N', 'X', 'B']})
  df_b["Greek"] = ""
  
    Letters Greek
  0       Y      
  1       E      
  2       N      
  3       X      
  4       B      
  </code></pre>
  
  <p>I want to fill in column 'Greek' in <code>df_b</code> using corresponding values from <code>df_a</code> and I can do that using nested loops as follows: </p>
  
  <pre><code>for i, row in df_a.iterrows():
      temp1 = row['Letters']
      for k, row in df_b.iterrows():
          temp2 = row['Letters']
          if temp1 == temp2:
              df_b.loc[k, "Greek"]=df_a.loc[i, "Greek"]
  </code></pre>
  
  <p>df_b</p>
  
  <pre><code>Letters    Greek
  0       Y         
  1       E  epsilon
  2       N       nu
  3       X      chi
  4       B     
  </code></pre>
  
  <p>First, I'm wondering if I can achieve the same result more efficiently using <code>merge</code>, <code>zip</code>, <code>join</code> or the other concatenation functions. Second, if I provide a matching <code>else</code> to the <code>if</code> statement, as follows:   </p>
  
  <p><code>else: df_b.loc[k, "Greek"] = float('nan')</code></p>
  
  <p>I expected this would fill in the empty cells with <code>NaN</code> and not modify the other cells. Instead, I get something like:</p>
  
  <p>df_b</p>
  
  <pre><code>  Letters Greek
  0       Y   NaN
  1       E   NaN
  2       N   NaN
  3       X   chi
  4       B   NaN
  </code></pre>
  
  <p>I appreciate your thoughts on the 2 points. Any additional feedback is welcome.</p>