I have a data frame like
index A B C
0 4 7 9
1 2 6 2
2 6 9 1
3 7 2 4
4 8 5 6
I want to create another data frame out of this based on the sum of C column. But the catch here is if the sum of C reached 10 or higher it should create another row. Something like this.
index A B C
0 6 13 11
1 21 16 11
Any help will be highly appreciable. Is there a robust way to do this, or iterating is my last resort?
There is a non-iterative approach. You'll need a
groupby
based onC % 11
.