Q:

How can I filter a dataframe by a subset of a string?

I'm trying to apply a filter to a dataframe based on whether a certain string is a substring of the values in a column. 
For example: Let's call the substring 'X' and I want to retrieve all rows where 'X' is a substring of the value in a column called 'A'. 
It feels like the code should look something like this:
df["X" in df.A]

or this:
df.loc("X" in df.A) 

or something along those lines. Does anyone have an idea on how I can achieve this?

A:

try this
res = df[df['A'].str.contains("X")]

