Merging 2 dataframe using similar columns
<p>I have 2 dataframe listed as follow</p>

<p>df</p>

<pre><code> Type       Breed     Common Color  Other Color  Behaviour
 Golden      Big           Gold          White        Fun      
 Corgi      Small          Brown         White       Crazy
 Bulldog    Medium         Black         Grey        Strong
</code></pre>

<p>df2</p>

<pre><code> Type              Breed    Behaviour   Bark Sound
 Pug               Small      Sleepy          Ak
 German Shepard    Big        Cool            Woof
 Puddle            Small      Aggressive      Ek
</code></pre>

<p>I wanted to merge 2 dataframe by columns <code>Type</code>, <code>Breed</code> and <code>Behavior</code>.</p>

<p>Therefore, my desire output would be:</p>

<pre><code>Type           Breed      Behavior
Golden          Big         Fun
Corgi           Small       Crazy  
Bulldog         Medium      Strong
Pug             Small       Sleepy
German Shepard  Big         Cool
Puddle          Small       Aggressive
</code></pre>

<p>using <code>join</code> dropping columns that don't overlap</p>

<pre><code>df1.T.join(df2.T, lsuffix='_').dropna().T.reset_index(drop=True)
</code></pre>

<p><a href="http://i.stack.imgur.com/wb6AL.png" rel="nofollow"><img src="http://i.stack.imgur.com/wb6AL.png" alt="enter image description here"></a></p>

python pandas multiple-columns intersection concat