title: How to filter rows by custom function Pandas?
body: <p>I have a custom regex Python function that checks is it email or not:</p>
  <pre><code>def isEmail(str):
    return True;
  </code></pre>
  <p>I want to iterate all rows in Pandas dataframe and validate the column <code>email</code>. and return count ofvalid rows (true/false).</p>
  <p>I have found <code>apply()</code> Pandas function.</p>
  <p>I try to leave only rows where column email has correct email address:</p>
  <pre><code>def isEmail(str):
      return re.search('regex', str)
  
      dt[isEmail(dt['email'])])
  </code></pre>
  <p>Then call this again to count how much incorrect rows to put into Python set:</p>
  <pre><code>incorrectEmails = {emails: 0}
  count = dt[isEmail(dt['email'])])
  incorrectEmails.set(count)
  </code></pre>