I want to merge rows by matching multiple ids. But all id's condition is different. For example for the first column 'a' == 'a' and "This".find("is") if this both condition is true then merge those rows
But in id terms, it can be substring. For example, "art" is a substring of "Earth" so, we will consider that's the same thing
Below example, I used name and email as ID, and only the 1st and 4th number rows are merged. Because the name is the same and the email [email protected] is available(substring) in 1 number row So, we will merge other all columns like subjects.
df1
id name email Subjects
1 raj [email protected], [email protected], [email protected] Maths
2 hardik [email protected] Science
3 parth - English
4 raj [email protected] Biology
result
id name email Subjects
1 raj [email protected], [email protected], [email protected] Maths, Biology
2 hardik [email protected] Science
3 parth - English