I have a DataFrame like this:
| cat0 | cat1 | cat2 | col_list | Quantity |
| ----- | ---- | ---- | ----------| -------- |
| alpha | x | a | [a,b,c,d] | 4 |
| alpha | y | a | [e] | 1 |
| beta | z | a | [f,g] | 2 |
| gamma | p | b | [h] | 1 |
| gamma | q | b | [I,j,k,l] | 4 |
| phi | r | c | [r,s] | 2 |
| eita | s | c | [m,n] | 2 |
I want it to transform it based on cat2 column. If they have same value then combine those rows into 1 and merge the rows like this:
| cat0 | cat1 | cat2 | col_list | Quantity |
| ---------- | ----- | ---- | ----------------| -------- |
| alpha,beta | x,y,z | a | [a,b,c,d,e,f,g] | 7 |
| gamma | p,q | b | [h,I,j,k,l] | 5 |
| phi,eita | r,s | c | [r,s,m,n] | 4 |
If column have strings values (column: cat0,cat1) join and separate them by a comma. If it has list values (column" col_list) then add those elements into a single list. If it is a int value (column: Quantity), then just add them.