title: Python function partial string match
body: <p>I have a pandas dataframe like this:</p>
  
  <pre><code>a      b      c
  foo    bar    baz
  bar    foo    baz
  foobar barfoo baz
  </code></pre>
  
  <p>I've defined the following function in python:</p>
  
  <pre><code>def somefunction (row):
      if row['a'] == 'foo' and row['b'] == 'bar':
          return 'yes'
      return 'no'
  </code></pre>
  
  <p>It works perfectly fine. But I need to make a small tweak to the <code>if</code> function to take into account <code>partial string</code> matches.</p>
  
  <p>I've tried several combinations, but I can't seem to get it to work. I get the following error:</p>
  
  <p><code>("'str' object has no attribute 'str'", 'occurred at index 0')</code></p>
  
  <p>The function Iv'e tried is:</p>
  
  <pre><code>def somenewfunction (row):
      if row['a'].str.contains('foo')==True and row['b'] == 'bar':
          return 'yes'
      return 'no'
  </code></pre>