I know this question is similar to this but my question is to have the sum of all values as I am fairly new to pandas and I don't have any Idea to pull this off.
currently, I can sum all the value of columns and add it on the df with the following code
df.loc[:,'x':'y'].sum(axis = 1)
+---+---+---+-------+
| x | y | z | total |
+---+---+---+-------+
| 1 | 2 | 1 | 4 |
| 0 | 1 | 1 | 2 |
| 1 | 0 | 0 | 1 |
+---+---+---+-------+
is there a way to have the sum of all columns and place it on the start of the dataframe?
+-------+---+---+---+
| total | x | y | z |
+-------+---+---+---+
| 4 | 1 | 2 | 1 |
| 2 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
+-------+---+---+---+