can u help me, how to do vlookup or pd merge on speccific column in the blank excel column. I just know how to do pd merge and the value come as a new column
I have a dataframe df1
index id Value Info
0 0 A1 xxx
1 1 A2 xxx
2 2 A3 xxx
3 3 A4 xxx
and also this data frame df2
index id Value
0 0 A1 Apple
1 1 A2 Orange
2 2 A3 Banana
3 3 A4 Grape
I wish to get to the following outcome when merging df1 and df2
index id Value Info
0 0 A1 Apple xxx
1 1 A2 Orange xxx
2 2 A3 Banana xxx
3 3 A4 Grape xxx
This could be straight forward considering pandas operations.
df1 = pd.DataFrame({"index":[0,1,2,3],"id":["A1","A2","A3","A4"],"Info":['xx1','xx2','xx3','xx4']})
df1
df2 = pd.DataFrame({"index":[0,1,2,3],"id":["A1","A2","A3","A4"],"Value":['Apple','Orange','Banana','Grape']})
df2
You could use:
df1.merge(df2)
which gives the below output:
index id Info Value
0 0 A1 xx1 Apple
1 1 A2 xx2 Orange
2 2 A3 xx3 Banana
3 3 A4 xx4 Grape