Answers for "query in python for multiple conditions"

5

how to slicing dataframe using two conditions

# when you wrap conditions in parantheses, you give order
# you do those in brackets first before 'and'
# AND
movies[(movies.duration >= 200) & (movies.genre == 'Drama')]
Posted by: Guest on March-21-2020
6

or condition in pandas

df1 = df[(df.a != -1) & (df.b != -1)]
Posted by: Guest on June-03-2020

Code answers related to "query in python for multiple conditions"

Python Answers by Framework

Browse Popular Code Answers by Language