Let’s see how to get all rows in a Pandas DataFrame containing given substring with the help of different examples.
Code #1: Check the values PG in column Position
But this result doesn’t seem very helpful, as it returns the bool values with the index. Let’s see if we can do something better.
Code #2: Getting the rows satisfying condition
Code #3: Filter all rows where either Team contains ‘Boston’ or College contains ‘MIT’.
Code #4: Filter rows checking Team name contains ‘Boston and Position must be PG.
Code #5: Filter rows checking Position contains PG and College must contains like UC.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course