I have a DataFrame that looks something like this:
Name Count
0 John 0.25
1 Adam 0.75
2 Michael 1.5
3 Jane 0.8
4 Anna 2.0
5 Sarah 0.25
My objective is to split this DataFrame into multiple DataFrames based on a limit value. For this example, the limit value will be 3 - so the result would look like:
Name Count
0 John 0.25
1 Adam 0.75
2 Michael 1.5
Name Count
0 Jane 0.8
1 Anna 2.0
Name Count
0 Sarah 0.25
The point is that in each of the new DataFrames, the sum of the counts approaches the limit value, but does not exceed it (i.e. Jane is in the second DataFrame, because if she was included in the first, the sum would be 3.3, which exceeds the limit value of 3).
I believe this is possible with .iterrows, but that's decently heavy/slow, so looking for another solution.