I have a fruit count dataframe.From the dataframe i have total count as 7, these fruit will distributed for 7 days each fruit per day.
fruit count
apple 3
orange 1
lemon 1
cherry 1
banana 1
Rules for splitting the fruit:
1.Apple fruit should not sent on consecutive days,Maintain a gap of at least a day between the apples.
2.orange has to be sent on day7(i.e last day).
3.On day 6 the lemon should not be sent, Maintain a gap of at least a day between orange and lemon
4.Do not accomodate any other fruits with lemon and orange,If fruit count is more than 7 then accomodate with apple or cherry or banana.
Expected_ouput
day fruit
d1 apple
d2 cherry
d3 apple
d4 lemon
d5 apple
d6 banana
d7 orange
case 1 - Less than 7 fruits
fruit count
apple 1
orange 1
lemon 1
cherry 1
banana 1
output expected:
day fruit
d1 apple
d2 cherry
d4 lemon
d6 banana
d7 orange
case 2 - more than 7 fruits:
fruit count
apple 3
orange 1
pomerante 1
lemon 1
cherry 1
banana 1
Expected_ouput
day fruit
d1 apple
d2 cherry
d3 apple
d3 pomegranate
d4 lemon
d5 apple
d6 banana
d7 orange
I have tried:
apple = 3
orange = 1
week = 7
start_day=1
end_day = 8
days = [f"Day{i}" for i in range(start_day,end_day)]
profile = {key : [] for key in days}
profile["Day7"].append("orange")
c = 6 // apple
apple_day = 1
for i in range(apple):
profile["Day{}".format(apple_day)].append("apple")
apple_day += c
Output:
{'Day1': ['apple'],
'Day2': [],
'Day3': ['apple'],
'Day4': [],
'Day5': ['apple'],
'Day6': [],
'Day7': ['orange']}