Ok, I'm stumped and have surfed all available pages, followed it all, and still ugh!
So here is my df. I want to add all the values in row 4 together and have a row total at end, then do it for 5, 6, 7... I use .concat()
and .sum()
and get key errors or too many arguments, tried .groupby
, and even .add()
(worth a try) as the columns are 'lists', nothing gives totals.
1day 2day 3day 4day 5day 6day 7day
4 2.979 2.979 2.979 2.979 2.979 2.979 2.979
5 9.543 9.543 9.543 9.543 9.543 9.543 9.543
6 5.222 5.222 5.222 5.222 5.222 5.222 5.222
7 0.319 0.319 0.319 0.319 0.319 0.319 0.319
10 -4.491 -4.491 -4.491 -4.491 -4.491 -4.491 -4.491
14 2.178 2.178 2.178 2.178 2.178 2.178 2.178
15 7.507 7.507 7.507 7.507 7.507 7.507 7.507
16 0.612 0.612 0.612 0.612 0.612 0.612 0.612
17 4.488 4.488 4.488 4.488 4.488 4.488 4.488
I had some luck with df.groupby(df.index)[['1day','2day'...'7day'].sum()
but it just pushes them together, not adds them. (I am aware that all the values are equal)
In excel, sum(a1:g1) but in pandas, I'm just writing into a deeper hole, please help!
screen shot of df, may be a better view