I am encountering an error when using exec() to execute a function that requires a DataFrame as input. Passing a dictionary containing all the required arguments, but getting the following error:
_exec_output = position_parity(**{‘feature_importance’: Variable Importance
SyntaxError: invalid syntax. Perhaps you forgot a comma?
Does anyone know how to resolve this? Thank you!
The code used:
code = f"{func_name}(**{args})"
print(args)
exec(f"_exec_output = {code}", globals())
Amina Tkhamokova is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.