0

I have two dataframes, let's say

df:
Title, number
Title 1, 20

And df2:

Label, othercount
Title 1, 30
Title 2, 50

I want to get

df_merged:
Title, number, othercount
Title 1, 20, 30

Basically I would like that if a value in Label matches a value in Title, I will add the corresponding column value to df_merged.

For that, I did:

f_column = df2["Label"]
df_merged = pd.concat([df,f_column], axis = 1)

But this outputs a merged df that doesn't have the correct values in place. What can I do?

0 Answers0