How to merge the content of a pandas column that makes two rows distinct?

I have a dataframe that contains some rows that are equal with regard to all but one column, how could I merge the content of that one column they are not equal to each other

The question sounds complicated but here's what I have:

   col_a   col_b   col_c
   1       2       3,4,5
   1       2       3,6
   1       3       5

And what I want:

   col_a   col_b   col_c
   1       2       3,4,5,6
   1       3       5

Since row 1 and row 2 only differ in col_c, I want to simply merge the two rows. But row 3 also differs in col_a, therefore it must stay the same.

Any ideas how to approach this?

Read more here:

Content Attribution

This content was originally published by user412 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: