0

I am trying to concat two dataframes but I keep running into an issue that they are not the same size. I have figured out that the issue is due to duplicates on the second column. e.g.

df1 looks like:

query   search   value_1
query1  search1  20
query2  search1  15

and df2 looks like:

query   search   value_2
query1  search2  20
query2  search1  12

and I want the final_df to look like:

query   search   value_1 value_2
query1  search1  20      NaN
query2  search1  15      12
query1  search2  NaN     20

So I think the issue is that the dataframes concat on query which is the index, and the search values are different so it doesn't make enough rows.

Error would be 'ValueError: Shape of passed values is (4, 4), indices imply (3, 4)' for this

Any help appreciated.

Ross
  • 21
  • 3

0 Answers0