Filtering strings in Pandas dataframes
Question
Given the following dataframe, write code using Python (Pandas) to return the rows that contain the string 'J'
in the name
column (to practice searching string contains).
Next, write code to return all rows where favorite_color
does not contain the string 'r'
.
Age | Favorite Color | Grade | Name |
---|---|---|---|
20 | blue | 88 | Willard Morris |
19 | blue | 95 | Al Jennings |
22 | yellow | 92 | Omar Mullins |
21 | green | 70 | Spencer McDaniel |
Click here to view this question in an interactive Colab (Jupyter) notebook.