I am automating the calculation of an Excel file, which looks as follows:
| |Measure 1|Measure 2|
|Company1| 4 | 5 |
|Company2| 7 | 3 |
|Company3| 3 | 1 |
|Company4| 5 | 8 |
I want to calculate the total of Measure 1 and Measure 2 over all companies (So 19 and 17, respectively). I have imported the Excel file using pandas and am looking for a formula like SUM(B2:B5) and SUM(C2:C5). Ideally I would define new variables which equal to these totals so I can append them to the bottom.
Moreover, the number of companies can differ every time I run the Python code, so I would like it to work dynamically.
Thanks!