Search code examples
pythonpandasjoinmergeconcatenation

Pandas merge, join Problem with joining column


I have to big tables For example

df1 = 
Name Age
Alex 20
Bob  19
Don  56

df2 =
Name PL
Don  Python
Bob  C
Alex java

I want to get

df3 = 
Name Age PL
Alex 20  Java
Bob  19  C
Don  56  Python

Solution

  • One of possible solutions:

    df3 = pd.merge(df1, df2, on='Name')
    

    The result is:

       Name  Age      PL
    0  Alex   20    Java
    1   Bob   19       C
    2   Don   56  Python