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 b@gmail.com is available(substring) in 1 number row So, we will merge other all columns like subjects.
df1
id name email Subjects
1 raj a@gmail.com, b@gmail.com, c@gmail.com Maths
2 hardik d@gmail.com Science
3 parth - English
4 raj b@gmail.com Biology
result
id name email Subjects
1 raj a@gmail.com, b@gmail.com, c@gmail.com Maths, Biology
2 hardik d@gmail.com Science
3 parth - English