I have 2 dataframes:
- A = col (Ids, a,b,c,d); size = 40*5
- B = col (Ids,y,z); size =100*3
I need to get it as follows: C = col (Ids,a,b,c,d,y,z) only where A.ids = B.ids
I tried merge and concat, but not reaching the right ans.
Thanks in advance
CodePudding user response:
Make sure that the columns merged have the same dtype
and then use pandas.merge
:
C = A.merge(B, on="Ids") # how="inner" by default