I have two dataframes:
>>> df1
[Output]: col1 col2 col3 col4
a abc 10 str1
b abc 20 str2
c def 20 str2
d abc 30 str2
>>> df2
[Output]: col1 col2 col3 col5 col6
d abc 30 str6 47
b abc 20 str5 66
c def 20 str7 53
a abc 10 str5 21
Below is what I want to generate:
>>> df_merged
[Output]: col1 col2 col5
a abc str5
b abc str5
c def str7
d abc str6
I don't want to generate more than 4 rows and that is usually what happens when I try to merge the dataframes. Thanks for the tips!
merge? I see only a sorteddf2with subsetted columns?