Consider below DF, I have an input number=4 to be inserted evenly in different hour buckets.
p_hourly mins
0 2020-09-10 07:00:00 60.0
1 2020-09-10 08:00:00 60.0
2 2020-09-10 09:00:00 60.0
3 2020-09-10 10:00:00 0.0
This means, 4 has to be divided evenly into 4 p_hourly buckets. Let's have i=1
for each bucket. Now for each iteration, we have to check which mins
value is highest and add 1
to its specific i bucket
and divide mins
by the new i bucket
value. In case of a row, all mins
values are the same, we simply take the first one!
I figured out a solution in excel, but need to use python to get this done!