I have two dataframes with names df1 and df2.
df1=
col1 col2 count
0 1 36 200
1 12 15 200
2 13 17 100
df2=
product_id product_name
0 1 abc
1 2 xyz
2 3 aaaa
3 12 qwert
4 13 sed
5 15 qase
6 36 asdf
7 17 zxcv
The entries in col1 and col2 are product_id from df2.
I want to make a new dataframe 'df3', which has the following columns and entries.
df3=
col1 | col1_name | col2 | col2_name | count
0 1 | abc | 36 | asdf | 200
1 12 | qwert | 15 | qase | 200
2 13 | sed | 17 | zxcv | 100
i.e add a col1_name and col2_name wherever product_id from df2 is equal to col1 & col2 values.
Is it possible to do so with:
df3 = pd.concat([df1, df2], axis=1)
My knowledge of Pandas df and Python is beginner level. Is there a way to do so? Thanks in advance.