I have the following dataframe:
id phone email
10352897
10352897 10225967
10352897 user@gmail.com
10352897 10225967 user@gmail.com
10225967
10225967 user@gmail.com
user@gmail.com
23578910
23578910 38256789
23578910 user2@gmail.com
23578910 38256789 user2@gmail.com
38256789
38256789 user2@gmail.com
user2@gmail.com
65287930 user3@gmail.com
65287930
user3@gmail.com
65287930
70203065
70203065
70203065
user4@gmail.com
user4@gmail.com
user4@gmail.com
Not all the fields are always filled in, but they are related to each other in at least one column.
I would like that when it coincides in at least one of the three columns, the record joins and prioritizes the filled fields over the empty ones, in the end in this example I would expect the following output:
id phone email
10352897 10225967 user@gmail.com
23578910 38256789 user2@gmail.com
65287930 user3@gmail.com
70203065
user4@gmail.com
How would you go about doing this?