How to merge two rows into one?

Question:

If I have the following table:

enter image description here

How can I merge two or more rows based on a specific column? In this case, it is column Col_4.

enter image description here

Thanks

Asked By: Isaac A

||

Answers:

A simple groupby with agg will do the trick

df.groupby(['Col_1','Col_2','Col_3'],as_index = False).agg(list)
Answered By: INGl0R1AM0R1
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.