Given this DataFrame
r3 value
r1 r2
1 2 3 1
2 4 1
3 2 1
3 4 1
4 2 1
4 3 1
2 1 3 1
1 4 1
3 1 1
3 4 1
4 1 1
4 3 1
...what's the best way to do this?
r3 value
r1 r2
1 2 3,4 2
3 2,4 2
4 2,3 2
2 1 3,4 2
3 1,4 2
4 1,3 2
Basically, I'm trying to condense the r3 column into a comma delimited string. The value column can be achieved a different way later on if necessary, or if it can be done through this whole process, even better.
(r1, r2)withr3becoming the concatenation of all the individualr3s andvaluebecoming the sum of all the individualvalues? (Your data could make this more obvious by having differing numbers of rows grouped and by using something other than 1 for some of the values).