I have a 5 column df. I need to groupby by the common names in column A, and sum column B and D. But I need to keep my output that currently sits in columns C through E. Everytime I groupby its drops columns not involved in the the grouping. I understand some columns will have 2 non common rows, for a common item in column A, and I need to display both of those values. Hope an example illustrates the problem better.
A | B | C | D | E |
---|---|---|---|---|
Apple | 10 | Green | 1 | X |
Pear | 15 | Brown | 2 | Y |
Pear | 5 | Yellow | 3 | Z |
Banana | 4 | Yellow | 4 | P |
Plum | 2 | Red | 5 | R |