How can I achieve the expected result from the following DataFrame
df
col_1 col_2 col_3 col_4
0 Non-Saved www.google.com POST 20,567
1 www.google.com POST
2 www.facebook.com GET
3 www.facebook.com OTHER
4 www.linkedin.com GET
5 Saved www.Quora.com POST 6,337
6 www.gmail.com POST
7 www.gmail.com GET
Expected result:
col_1 col_2 col_3 col_4
0 Non-Saved www.google.com POST 20,567
www.facebook.com GET
www.linkedin.com OTHER
1 Saved www.Quora.com POST 6,337
www.gmail.com GET
from 8 rows to 2 rows by merging the empty strings in col_1 and col_3. Also, concatenating distinct values in col_2 and col_3 into one cell. Can anyone help me with an user-defined function to do this?