hey guys so I've been trying to learn python. Now im trying to calculate something with sympy, but no matter what i do it seems to keep giving me attribute error like such. AttributeError: 'dict' object has no attribute 'evalf'. Any ideas why?
def panda_thing(data, pca):
header = data[0]
data = data[1:]
df = pd.DataFrame(data, columns=header)
df['Amount'] = df['Amount'].astype(float)
df['Class'] = df['Class'].astype(int)
x = sp.symbols('x')
expr = 2.5 * x**3 + 3 * x**2 + 3.5 * x + 5
derivative_expr = sp.diff(expr, x)
normal_amounts = df[df['Class'] == 0]['Amount'].tolist()
malicious_amounts = df[df['Class'] == 1]['Amount'].tolist()
normal_derivatives = [float(derivative_expr.subs(x, amt).evalf()) for amt in normal_amounts]
malicious_derivatives = [float(derivative_expr.subs(x, amt).evalf()) for amt in malicious_amounts]
Q1 = [normal_derivatives, malicious_derivatives]
a = sp.symbols('a')
eq = a * x + 3
Q2 = [((sp.solve(a * x + 3)[0].evalf()), 1) for pca_val in pca]
return [Q1, Q2]```