title: Join two data frame with two columns values of a df with a single column values of another dataframe. based on some conditions?
body: <p>I have a dataframe like this:</p>
  
  <pre><code>df1
  col1       col2      col3      col4
   1           2        A         S
   3           4        A         P
   5           6        B         R
   7           8        B         B
  </code></pre>
  
  <p>I have another data frame:</p>
  
  <pre><code>df2
  col5      col6         col3
   9         10           A
   11        12           R
  </code></pre>
  
  <p>I want to join these two data frame if any value of col3 and col4 of df1 matches with col3 values of df2 it will join. </p>
  
  <p>the final data frame will look like:</p>
  
  <pre><code>df3
  col1    col2    col3    col5   col6
   1       2       A       9      10
   3       4       A       9      10
   5       6       R       11     12
  </code></pre>
  
  <p>If col3 value presents in df2 then it will join via col3 values else it will join via col4 values if it presents in col3 values of df2</p>
  
  <p>How to do this in most efficient way using pandas/python?             </p>