title: Pandas select rows where a value in a columns does not starts with a string
body: <p>I have a data where I need to filter out any rows that do start with a certain value<strong>s</strong> - emphasis on plural:</p>
  
  <p>Below the data exactly as it appears in file data.xlsx</p>
  
  <pre><code>Name                Remains
  GESDSRPPZ0161       TRUE
  RT6000996           TRUE
  RT6000994           TRUE
  RT6000467           TRUE
  RT6000431           TRUE
  MCOPSR0034          FALSE
  MCOPSR0033          FALSE
  </code></pre>
  
  <p>I need to be able to return a dataframe where name <strong>DOES NOT</strong> start with <strong>MCO, GE</strong>,etc.</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  ### data
  file = r'C:\Users\user\Desktop\data.xlsx'
  
  data  = pd.read_excel(file, na_values = '')
  data['name'] = data['name'].str.upper()
  
  prefixes = ['IM%','JE%','GE%','GV%','CHE%','MCO%']
  
  new_data = data.select(lambda x: x not in prefixes)
  
  
  new_data.shape
  </code></pre>
  
  <p>the last call returns exactly the same dataset as I started with.</p>
  
  <p>I tried:</p>
  
  <p><a href="https://stackoverflow.com/questions/17957890/pandas-select-from-dataframe-using-startswith">pandas select from Dataframe using startswith</a></p>
  
  <p>but it excludes data if the string is elsewhere (not only starts with)</p>
  
  <pre><code>df = df[df['Column Name'].isin(['Value']) == False]
  </code></pre>
  
  <p>The above answer would work if I knew exactly the string in question, however it changes (the common part is MCOxxxxx, GVxxxxxx, GExxxxx...)</p>
  
  <p>The vvery same happens with this one:</p>
  
  <p><a href="https://stackoverflow.com/questions/19960077/how-to-implement-in-and-not-in-for-pandas-dataframe">How to implement &#39;in&#39; and &#39;not in&#39; for Pandas dataframe</a></p>
  
  <p>because the values I have to pass have to be exact. Is there any way to do with using the same logic as here (Is there any equivalent for wildcard characters like SQL?):</p>
  
  <p><a href="https://stackoverflow.com/questions/11334674/how-do-i-select-rows-where-a-column-value-starts-with-a-certain-string">How do I select rows where a column value starts with a certain string?</a></p>
  
  <p><strong>Thanks for help! Can we expand please on the below?</strong></p>
  
  <p>@jezrael although I've chosen the other solution for simplicity (and my lack of understanding of your solution), but I'd like to ask for a bit of explanation please. What does <strong>'^' + '|^'</strong> do in this code and how is it different from Wen's solution? How does it compare performance wise when you have for loop construct as oppose to operation on series like map or apply? If I understand correctly <strong>contains()</strong> is not bothered with the location whereby startswith() specifically looks at the beggining of the string. Does it mean the 
   ^indicates to contains() to do what? Start at the beginning?
   And <strong>|</strong> is it another special char for the method or is it treated like <strong>logical OR</strong>? I'd really want to learn this if you don't mind sharing. Thanks</p>