title: Adding a column with values from another dataframe based on column conditions
body: <p>I have two dataframes of differing index lengths that look like this:</p>
  
  <p>df_1:</p>
  
  <pre><code>    State  Month  Total Time ... N columns
       AL     4       1000
       AL     5       500
        .
        .
        .
       VA     11      750
       VA     12      1500 
  </code></pre>
  
  <p>df_2:</p>
  
  <pre><code>    State   Month ... N columns
       AL      4        
       AL      5
        .
        .
        .
       VA      11
       VA      12
  </code></pre>
  
  <p>I would like to add a Total Time column to df_2 that uses the values from the Total Time column of df_1 if the State and Month value are the same between dataframes. Ultimately, I would end up with:</p>
  
  <p>df_2:</p>
  
  <pre><code>    State  Month  Total Time ... N columns
       AL     4       1000
       AL     5       500
        .
        .
        .
       VA     11      750
       VA     12      1500 
  </code></pre>
  
  <p>I want to do this conditionally since the index lengths are not the same. I have tried this so far:</p>
  
  <pre><code>def f(row):
       if (row['State'] == row['State']) &amp; (row['Month'] == row['Month']):
           val = x for x in df_1["Total Time"]
       return val
  
  df_2['Total Time'] = df_2.apply(f, axis=1)
  </code></pre>
  
  <p>This did not work. What method would you use to accomplish this?
  Any help is appreciated!</p>