0

I have two dataframes.

The first dataframe is A.

enter image description here

And the second dataframe is B.

enter image description here

Basically both dataframes have AdId fields. First dataframe has unique AdIds per row but the second dataframe has multiple instances of a single AdId. I want to get all the information of that AdId to the second dataframe.

I am expecting the output as follows

enter image description here

I have tried the following code

B.join(A, on='AdId', how='left', lsuffix='_caller')

But this does not give the expected output.

thedarkpassenger
  • 7,158
  • 3
  • 37
  • 61

1 Answers1

0

Use pandas concat:

result = pd.concat([df1, df4], axis=1, sort=False)

More on merging with pandas: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#set-logic-on-the-other-axes

Joost Döbken
  • 3,450
  • 2
  • 35
  • 79