I have a dataframe like this:
A B
1 2
3 4
9 1
And a dataframe like this:
A C
1 3
2 4
3 5
4 6
I would like to merge the first dataframe and the second one to give a output like this:
A B C
1 2 3
3 4 5
9 1 NaN
I have a dataframe like this:
A B
1 2
3 4
9 1
And a dataframe like this:
A C
1 3
2 4
3 5
4 6
I would like to merge the first dataframe and the second one to give a output like this:
A B C
1 2 3
3 4 5
9 1 NaN
 
    
    Try:
x = df1.merge(df2, on="A", how="left")
print(x)
Prints:
   A  B    C
0  1  2  3.0
1  3  4  5.0
2  9  1  NaN
