title: Removing rows in a pandas DataFrame where the row contains a string present in a list?
body: <p>I know how to remove rows from a single-column ('From') pandas DataFrame where the row contains a string e.g given <code>df</code> and <code>somestring</code>:</p>
  
  <pre><code>df = df[~df.From.str.contains(someString)]
  </code></pre>
  
  <p>Now I wish to do something similar, but this time I wish to remove any rows that contain a string that is in any element of another <strong>list</strong>. Were I not using pandas, I would use <code>for</code> and the <code>if ... not ... in</code> approach. But how do I take advantage of pandas' own functionality to achieve this? Given the list of items to remove <em>ignorethese</em>, extracted from a file of comma-separated strings <em>EMAILS_TO_IGNORE</em>, I tried:</p>
  
  <pre><code>with open(EMAILS_TO_IGNORE) as emails:
          ignorethese = emails.read().split(', ')
          df = df[~df.From.isin(ignorethese)]
  </code></pre>
  
  <p>Am I convoluting matters by first decomposing the file into a list? Given that it is a plain text file of comma-separated values, can I bypass this with something simpler?</p>