title: pandas dataframe list partial string matching python
body: <p>I have a dataframe <code>df</code>:</p>
  
  <p>df:  </p>
  
  <pre><code>        chr          gene_name
  0        1           ARF3
  1        1           ABC
  2        1           ARF3, ENSG123
  3        1           ENSG,ARF3
  4        1           ANG
  5        2           XVY
  6        2           PQR
  7        3           RST
  8        4           TAC 
  </code></pre>
  
  <p>and a gene_list</p>
  
  <pre><code>gene_list = ['ARF3','ABC' ]
  </code></pre>
  
  <p>Now, I need to get the rows from the data frame (<code>df</code>) for which the gene name is either an exact match with elements in <code>gene_list</code>. </p>
  
  <p>So, I tried: </p>
  
  <pre><code>df2 = df1[df.gene_name.isin(gene_list)]
  </code></pre>
  
  <p>I retrieved: </p>
  
  <pre><code>       chr           gene_name
  0        1           ARF3
  1        1           ABC
  </code></pre>
  
  <p>but what I am expecting is: </p>
  
  <pre><code>        chr          gene_name
  0        1           ARF3
  1        1           ABC
  2        1           ARF3, ENSG123
  3        1           ENSG,ARF3
  </code></pre>
  
  <p>so basically all the rows in the data frame where the element in <code>gene_list</code> is a substring of <code>gene_name</code> in the data frame. </p>
  
  <p>I thought of using <code>.contains()</code> had it been I was looking the other way that is <code>gene_name</code> in the data frame would have been a substring on element in <code>gene_list</code>. </p>
  
  <p>All the help appreciated</p>