1# Multiple Criteria dataframe filtering
2movies[movies.duration >= 200]
3# when you wrap conditions in parantheses, you give order
4# you do those in brackets first before 'and'
5# AND
6movies[(movies.duration >= 200) & (movies.genre == 'Drama')]
7
8# OR
9movies[(movies.duration >= 200) | (movies.genre == 'Drama')]
10
11(movies.duration >= 200) | (movies.genre == 'Drama')
12
13(movies.duration >= 200) & (movies.genre == 'Drama')
14
15# slow method
16movies[(movies.genre == 'Crime') | (movies.genre == 'Drama') | (movies.genre == 'Action')]
17
18# fast method
19filter_list = ['Crime', 'Drama', 'Action']
20movies[movies.genre.isin(filter_list)]
21