edit: I understand how to get the actual values, but I wonder how to append a row with these 2 sums to the existing df?
I have a dataframe score_card that looks like:
15min_colour | 15min_high | 15min_price | 30min_colour | 30min_high | 30min_price |
---|---|---|---|---|---|
1 | 1 | -1 | 1 | -1 | 1 |
1 | -1 | 1 | 1 | 1 | 1 |
-1 | 1 | -1 | 1 | 1 | 1 |
-1 | 1 | -1 | 1 | -1 | 1 |
Now I'd like to add a row that sums up all the 15min numbers (first 3 columns) and the 30min numbers and so on (the actual df is larger). Means I don't want to add up the individual columns but rather the sum of the columns' sums. The row I'd like to add would look like:
sum_15min_colour&15min_high&15min_price | sum_30min_colour&30min_high&30min_price |
---|---|
0 | 8 |
Please disregard the header, it's only to clarify what I'm intending to do. I assume there's a multiindex involved, but I couldn't figure out how to apply it to my existing df to achieve the desired output.
Also, is it possible to add a colum with the sum of the whole table?
Thanks for your support.