title: Pandas: merge if left column matches any of right columns
body: <p>Is there a way to <em>merge</em> two data frames if one of the columns from left data frame matches any of the columns of the right data frame:</p>
  
  <pre><code>SELECT
    t1.*, t2.*
  FROM
    t1
  JOIN
    t2 ON t1.c1 = t2.c1 OR 
          t1.c1 = t2.c2 OR 
          t1.c1 = t2.c3 OR 
          t1.c1 = t2.c4
  </code></pre>
  
  <p>Python <em>(something like):</em></p>
  
  <pre><code>import pandas as pd
  
  dataA = [(1), (2)]
  
  pdA = pd.DataFrame(dataA)
  pdA.columns = ['col']
  
  dataB = [(1, None), (None, 2), (1, 2)]
  
  pdB = pd.DataFrame(dataB)
  pdB.columns = ['col1', 'col2']
  
  pdA.merge(pdB, left_on='col', right_on='col1') \
      .append(pdA.merge(pdB, left_on='col', right_on='col2'))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qjdwf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qjdwf.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/uyssS.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uyssS.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/6xc6R.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6xc6R.png" alt="enter image description here"></a></p>