why i failed to join two dataframes when using python pandas?
Question: 
    import pandas as pd
    from pandas import DataFrame
    
    l=[(1,10),(2,5), (3,7)]
    l2=[(1,5), (2,6), (3,8)]
    l3=[(2,3), (1,9), (3,9)]
    
    d1=DataFrame(l)
    d2=DataFrame(l2)
    d3=DataFrame(l3)
    
    j1=d1.join(d2, how='left')
    

**failed with error** : Exception: **columns overlap: Int64Index([0, 1],
dtype=int64)**

**what's wrong? what happened?**

    
    
    In [40]: d1
    Out[40]:
       0   1
    0  1  10
    1  2   5
    2  3   7
    
    In [41]: d2
    Out[41]:
       0  1
    0  1  5
    1  2  6
    2  3  8
    

what i need is to join d1 and d2 using the first colum, the result should be,
**which kind of DataFrame operation is needed?**

    
    
       0   1 2
    0  1  10 5
    1  2   5 6
    2  3   7 8
    


Answer: That won't work it looks what you want to do is to add just the last column
which you could achieve using `concat`:

    
    
    In [15]:
    # just add the last column
    j1=pd.concat([d1,d2[[1]]],axis=1)
    j1
    Out[15]:
       0   1  1
    0  1  10  5
    1  2   5  6
    2  3   7  8
    
    [3 rows x 3 columns]
    

or you should `merge`:

    
    
    In [19]:    
    j1 = d1.merge(d2, how='left', on=[0])
    j1
    Out[19]:
       0  1_x  1_y
    0  1   10    5
    1  2    5    6
    2  3    7    8
    
    [3 rows x 3 columns]
    
    In [20]:
    # now rename the columns that clashed
    j1.rename(columns={'1_x':'1', '1_y':'2'}, inplace=True)
    j1
    Out[20]:
       0   1  2
    0  1  10  5
    1  2   5  6
    2  3   7  8
    
    [3 rows x 3 columns]
    

If we analyse what went wrong with the join, you have a clash of columns which
it cannot resolve unless you specify a suffix:

    
    
    In [42]:
    
    j1=d1.join(d2, how='left',lsuffix='', rsuffix='_y')
    j1
    Out[42]:
       0   1  0_y  1_y
    0  1  10    1    5
    1  2   5    2    6
    2  3   7    3    8
    
    [3 rows x 4 columns]
    

We can now drop the superfluous column `0_y` and rename the added column:

    
    
    In [43]:
    
    j1.drop(labels=['0_y'],axis=1,inplace=True)
    j1.rename(columns={'1_y':'2'},inplace=True)
    j1
    Out[43]:
       0   1  2
    0  1  10  5
    1  2   5  6
    2  3   7  8
    
    [3 rows x 3 columns]
    

