I have a data frame in pandas as follows:
  A    B    C    D
  3    4    3    1
  5    2    2    2
  2    1    4    3
My final goal is to produce some constraints for an optimization problem using the information in each row of this data frame so I don't want to generate an output and add it to the data frame. The way that I have done that is as below:
def Computation(row):
    App = pd.Series(row['A'])
    App = App.tolist()
    PT = [row['B']] * len(App)
    CS = [row['C']] * len(App)
    DS = [row['D']] * len(App)
    File3 = tuplelist(zip(PT,CS,DS,App))
    return m.addConstr(quicksum(y[r,c,d,a] for r,c,d,a in File3) == 1)
But it does not work out by calling:
df.apply(Computation, axis = 1)
Could you please let me know if there is anyway to do this process?
 
     
    