I would like to pass some custom conditions/masks to a Pandas dataframe from a string and I am wondering if it is possible the way I would want it to be done. Please see the example code below:
#df is just some pandas dataframe from a csv
mask = 'df['Col1'] == 1 & df['Col2'] == 'Complete'
print(df[mask])
How do I do that in a way that works? How do I turn the string into just its contents? Is there any other method? I reckon this could be useful for many applications and not only Pandas.
NOTE: I am aware that I can pass multiple arguments using a dictionary but this is not the same case.