I want to merge two DataFrames on an exact match on the column Name
and a partial match between ID
and String
. Here is an example:
The first DataFrame (df1) looks like this:
Name ID Tag
AAA 1111 XYZ
AAA 1122 DEF
BBB 2222 PQR
BBB 2211 MNL
CCC 3333 STU
CCC 3311 JKL
DDD 4444 ABC
The second DataFrame (df2) looks like this;
String Name
aasd1111dasd AAA
sdf1122sdf AAA
sdffgs2222f BBB
fsfg3333sdf CCC
sefg4444sdf DDD
What I would like to get to is a join to give the following:
String Name Tag
aasd1111dasd AAA XYZ
sdf1122sdf AAA DEF
sdffgs2222f BBB PQR
fsfg3333sdf CCC STU
sefg4444sdf DDD ABC