I have this dataframe:
import pandas as pd
df = pd.DataFrame({'condition1': ['ON', 'OFF', 'ON'],
'condition2': [10, 15, 20],
'condition3' : ['OFF', 'ON', 'OFF']})
Output:
condition1 condition2 condition3
0 ON 10 OFF
1 OFF 15 ON
2 ON 20 OFF
Now lets say, I would like to execute "print('Hello World')
" IF 'condition1' is 'ON', 'condition2' is > 15, and 'condition3' is 'OFF'.
So based on the dataframe above 'Hello World' Would be printed when the 3rd row is evaluated as the set criteria have been fulfilled.
Please recommend a way to achieve the above goal, and provide a code snippet to demonstrate the solution.