'Sum column values on dataframe on the bottom of columns [duplicate]
I have a dataframe with different columns with different values, I would calculate the sum of the values for each column and put the result on the bottom of each column
So i have a dataframe like this:
| TEAM | A | B | C |
|---|---|---|---|
| RED | 4 | 12 | 3 |
| RED | 2 | 1 | 1 |
| BLUE | 3 | 1 | 2 |
| BLUE | 2 | 5 | 2 |
| YELLOW | 1 | 2 | 5 |
| YELLOW | 1 | 2 | 5 |
And I want this as result:
| TEAM | A | B | C |
|---|---|---|---|
| RED | 4 | 12 | 3 |
| RED | 2 | 1 | 1 |
| SUM | 6 | 13 | 4 |
| BLUE | 3 | 1 | 2 |
| BLUE | 2 | 5 | 2 |
| SUM | 5 | 6 | 6 |
| YELLOW | 1 | 2 | 5 |
| YELLOW | 1 | 2 | 5 |
| SUM | 2 | 4 | 10 |
IDK how to do that
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
