Filtering by a List/String Filters
In this lesson, you'll get a refresher on filtering using lists/strings in Pandas.
Filtering by a list
You have seen in the previous lesson how to utilize basic conditional operators such as ==
or >
to filter DataFrames.
Now, what if you want to filter based on a list? In a travel domain, you may want to filter travelers originating from either the US, UK, or Spain. Similarly, in a medical domain, you may need to filter patients who have diabetes, heart-failure, or asthma.
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.