I am reading a configuration file that contains some queries like these:
query = 'column_a in @certain_variable'
and variables:
variables:
certain_variable = ["val1","val2"]
certain_variable2 = ["val1","val2"]
... more
And the way I am doing it now is:
for k, v in variables.items():
exec (k + '=v')
df.query(query)
Because I don't see another way of making available variables from the yaml file to pandas.
The reason I am trying to remove exec is because I have some subfunctions that leads to errors (as described here: Why doesn't exec work in a function with a subfunction?)