I have the following dataframe:
ID Model_form A C Actual
1 Exp 2 1.4 4
2 Power model 1 0.2 3
3 Log 0.6 6 7
I am trying to solve different equations based on the model form:
If model form column contains 'exp' - A*(1-exp(C*actual))
If model form column contains 'pow' - A*(actual^C)
If model form column contains 'log' - A* Ln(1+C*optimal)
Currently I am solving this as follows,
c1 = df['Model_form']].str.contains('exp', flags = re.IGNORECASE)
c2 = df['Model_form']].str.contains('pow', flags = re.IGNORECASE)
c3 = df['Model_form']].str.contains('log', flags = re.IGNORECASE)
df['Actual(y)'] = np.select([c1,c2,c3], [df.eval(df['A']*(1-
np.exp(df['C']*df['Actual'])),df['A']*
(df['Actual']**df['C']),df['A']*np.log(1+df['C']*df['Actual']))])
I get the error:
eval() takes from 2 to 3 positional arguments but 4 were given