pandas dataframe mask all entries which include a string 1

pandas dataframe mask all entries which include a string

In [3]: df[df['ids'].str.contains("ball")]
Out[3]:
     ids  vals
0  aball     1
1  bball     2
3  fball     4

Here is what the above code is Doing:
1. df[df[‘ids’].str.contains(“ball”)]
2. df[‘ids’].str.contains(“ball”)
3. df[‘ids’]
4. df

Similar Posts