title: Return rows that are at the intersection of two lists using query function in pandas
body: <p>I have this df:</p>
  
  <pre><code>pd.DataFrame([[1, "type_1"], [2, "type_2"], [2, "type_1; type_2"], [2, "type_1; type_3"], [2, "type_3"], [2, "type_1; type_2, type_3"]],
                       columns=["a", "b"])
      a   b
  0   1   type_1
  1   2   type_2
  2   2   type_1; type_2
  3   2   type_1; type_3
  4   2   type_3
  5   2   type_1; type_2, type_3
  </code></pre>
  
  <p>and I need to use lots of query strings that I get from a config file, that look like these:</p>
  
  <pre><code>my_list = ["type_1", "type_2"]
  df.query("a == 2 and b in @my_list")
  </code></pre>
  
  <p>Now this outputs:</p>
  
  <pre><code>    a   b
  1   2   type_2
  </code></pre>
  
  <p>But I would want the output to be like this because at least one value from b is in my_list:</p>
  
  <pre><code>    a   b
  0   2   type_2
  1   2   type_1; type_2
  2   2   type_1; type_3
  3   2   type_1; type_2, type_3
  </code></pre>
  
  <p>The issue as you can see is that <strong>some of my columns are actually lists</strong>. At the moment they are strings separated by <code>;</code> but I can transform them into lists. However I'm not sure how this would help me filter rows that have at least one value from <code>column b</code> inside <code>my_list</code> <strong>using only .query()</strong> (because otherwise I'll have to parse the query string and it gets messy)</p>
  
  <p>This would be the equivalent code with lists:</p>
  
  <pre><code>pd.DataFrame([[1, ["type_1"]], [2, ["type_2"]], [2, ["type_1", "type_2"]], [2, ["type_1", "type_3"]], [2, "type_3"], [2, ["type_1", "type_2", "type_3"]]],
                       columns=["a", "b"])
  </code></pre>