I have a Pandas Dataframe that stores a food item on each row in the following format -
Id Calories Protein IsBreakfast IsLunch IsDinner
1 300 6 0 1 0
2 400 12 1 1 0
.
.
.
100 700 25 0 1 1
I want to print all three-row combinations with the following conditions -
- The combinations should contain at least one of the breakfast, lunch, and dinner.
- sum of calories should be between certain range (say minCal < sum of calories in three rows < maxCal)
- similar condition for proteins too.
Right now, I am first iterating over all breakfast items, choosing lunch items. Then iterating over all dinner items. After selecting a combination, I am adding relevant columns and checking if values are within the desired range