title: Python Pandas: String Contains and Doesn't Contain
body: <p>I'm trying to match rows of a Pandas DataFrame that contains and doesn't contain certain strings. For example:</p>
  
  <pre><code>import pandas
  df = pandas.Series(['ab1', 'ab2', 'b2', 'c3'])
  df[df.str.contains("b")]
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>0    ab1
  1    ab2
  2     b2
  dtype: object
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>2     b2
  dtype: object
  </code></pre>
  
  <p>Question: is there an elegant way of saying something like this?</p>
  
  <pre><code>df[[df.str.contains("b")==True] and [df.str.contains("a")==False]]
  # Doesn't give desired outcome
  </code></pre>