Hopefully this simple explanation will get across what I'm trying to do. Suppose I had a Pandas dataframe that had the following columns:
A B C D E
1 2 4 6 4
3 4 1 2 3
4 7 4 1 4
Does anyone know a way (without doing it manually) that I could create a new set of columns within that table that sum across subsets of permutations of the columns? I've been doing some searches and not had any luck given this being a rather specific query.
For instance if I wanted all combinations of sums of subsets of 3 columns from the 5 columns - some of the additional rows might like look like:
ABC ACE BDE
7 9 12
8 7 9
15 12 12
...and so in (in this case there'd be 5C3 = 10 rows - but I'm actually looking at a 7C4 example)
Thanks in advance !