Calculate spread based on previous and next data

15 Views Asked by At

I have a dataset splitted on an hour. For 1 day I have 24 buckets and based on the amount of data in one bucket I calculate the visitor ratio. For the day I have a total of 1000 items that will end. Based on the visitor ratio I put the 1000 items spread over the hour buckets.

For example I have the following ratios/numbers:

Hour 11: 0.0544

Hour 12: 0.0588

Hour 13: 0.0680

Hour 14: 0.0598

To be complete: In hour 12 I have 0.0588 of the total amount visitors of the whole day and I want to end ~59 items.

However these 59 items are spread evenly across the hour, but I want to spread it more based on the data of the visitors in the surrounding hours.

I want to calculate how to spread the data inside an hour according to the growth/decline based on the buckets next to it. My idea is to split every hour bucket in buckets of 10 minutes, but I don't know how to calculate the ratios for every 10 minute bucket.

Examples:

Hour 12: I know the ratio in hour 11 is lower and hour 13 has higher ratio. I know I should add more items in the later buckets as the ratio keeps growing.

Hour 13: Surrounding hours are lower. The peak should be in the middle of the hour.

Is there a way to calculate this kind of spreading?