I am new to def function , I am trying to get the logic in def function with multiple if condition. I want x,y,z to be flexible parameter so I can change parameter value in x,y,z. but i can't get the desired output. anyone help ?
df =
    date      comp  mark    value   score   test1
0   2022-01-01  a      1       10     100   
1   2022-01-02  b      2       20     200   
2   2022-01-03  c      3       30     300   
3   2022-01-04  d      4       40     400   
4   2022-01-05  e      5       50     500   
Desired ouput =
        date    comp    mark    value   score   test1
0   2022-01-01  a          1    10       100    200
1   2022-01-02  b          2    20       200    400
2   2022-01-03  c          3    30       300    600
3   2022-01-04  d          4    40       400    4000
4   2022-01-05  e          5    50       500    5000
I can get the result use:
    def frml(df):
        if (df['mark'] > 3) and (df['value'] > 30):
            return df['score'] * 10
        else:
            return df['score'] * 2
df['test1'] = df.apply(frml,axis=1)
but i can't get the result use this: isn't the logic is the same?
 x = df['mark']
 y = df['value']
 z = df['score']
def frml(df):
    if (x > 3) and (y > 30):
        return z * 10
    else:
        return z * 2
df['test1'] = df.apply(frml,axis=1)
 
     
    