Let\'s say that I have a dataframe like this one
import pandas as pd df = pd.DataFrame([[1, 2, 1], [1, 3, 2], [4, 6, 3], [4, 3, 4], [5, 4, 5]], columns=[\'A\
For existing matches, use query:
query
df.query(' A > 3' ).head(1) Out[33]: A B C 2 4 6 3 df.query(' A > 4 and B > 3' ).head(1) Out[34]: A B C 4 5 4 5 df.query(' A > 3 and (B > 3 or C > 2)' ).head(1) Out[35]: A B C 2 4 6 3