Счетчик Python со многими условиями - PullRequest
1 голос
/ 21 октября 2019

Мне нужно посчитать значения по столбцам «Расчет» и «Заказ». но у меня есть несколько таких условий:

Packed Size  Minimum Quantity   Active  Calculation  Order     Output(Count)
     7               6             1         7         7          0        #it is ok, calculation=order. no need to count
     3               6             0         6         6          1        #"calculation = order" but it shouldn't have any order. because not active day even if there is a calculation. so output is 1.
     3               4             1         3         3          1        #it shouldn't have any order. because calculation and order is lower than minimum quantity. so output is 1.
     4               3             1         4         3          1        #calculation is greater than minimum quantity and active is 1 and multiple of the packed size. so, order should be equal to calculation. output is 1.
     4               3             1         3         4          0        #calculation is lower than order and active is 1. but order must be multiples of 4 and 4 due to packed size column and greater than minimum quantity. so, output is 0. it is ok.
     5               4             1         7         7          1        #calculation and order is equal, active day and they are greater than minimum quantity. but they are not multiples of 5 or 5 due to packed size. so, output is 1.       

Как я могу получить элегантный код, соответствующий этим условиям? Не могли бы вы помочь об этом?

...