Concat two dataframes wit common columns : <p>I have two dataframes with same columns. Only one column has different values. I want to concatenate the two without duplication.</p>

<pre class="lang-py prettyprint-override"><code>df2 = pd.DataFrame({'key': ['K0', 'K1', 'K2'],'cat': ['C0', 'C1', 'C2'],'B': ['B0', 'B1', 'B2']})
df1 = pd.DataFrame({'key': ['K0', 'K1', 'K2'],'cat': ['C0', 'C1', 'C2'],'B': ['A0', 'A1', 'A2']})

df1
Out[630]: 
  key cat   B
0  K0  C0  A0
1  K1  C1  A1
2  K2  C2  A2
df2
Out[631]: 
  key cat   B
0  K0  C0  B0
1  K1  C1  B1
2  K2  C2  B2
</code></pre>

<p>I tried:</p>

<pre class="lang-py prettyprint-override"><code>result = pd.concat([df1, df2], axis=1)
result
Out[633]: 
  key cat   B key cat   B
0  K0  C0  A0  K0  C0  B0
1  K1  C1  A1  K1  C1  B1
2  K2  C2  A2  K2  C2  B2
</code></pre>

<p>The desired output:</p>

<pre><code>  key cat   B_df1  B_df2
0  K0  C0    A0     B0
1  K1  C1    A1     B1
2  K2  C2    A2     B2
</code></pre>

<p>NOTE: I could drop duplicates afterwards and rename columns but that doesn't seem efficient</p>
