title: Why isin does not filter rows Pandas?
body: <p>Dataset is:</p>
  <pre><code>AGE NUM
  18  1
  19  2
  20  3
  6   4
  </code></pre>
  <p>The <code>invalidatedNumsDb</code> is filled from database:</p>
  <pre><code>def getWrongNumbersDb():
      cursor = conn.cursor()
      cursor.execute(&quot;SELECT num FROM invalidated&quot;)
      return set([int(vl[0]) for vl in cursor.fetchall()])
  invalidatedNumsDb = getWrongNumbersDb()
  </code></pre>
  <p>The <code>invalidatedNumsDb</code> contains numbers <code>{1,2,3}</code></p>
  <p>After I try to filter all rows where <code>NUM</code> is not presented in <code>invalidatedNumsDb</code>:</p>
  <pre><code>report = {}
  report['num_file_dup'] = dataset.duplicated(subset=['NUM']).sum()
  report['num_invalid'] = (~dataset['NUM'].apply(checkNumber)).sum()
  report['num_dup_db'] = (dataset['NUM'].isin(invalidatedNumsDb)).sum()
  
  dataset.drop_duplicates(subset=&quot;NUM&quot;)
  filter1 = ~dataset['NUM'].isin(invalidatedNumsDb)
  filter2 = dataset['AGE'].apply(isOld)
  
  dataset = dataset[filter1 &amp; filter2]
  </code></pre>
  <p>As result I want to get the same frame excluding rows that returns false in <code>filter1</code> and <code>filter2</code>.</p>
  <p>But I always get full dataset despite <code>NUM</code> is presented in <code>{1,2,3}</code></p>
  <p>Result should be:</p>
  <pre><code>AGE NUM
  6   4
  </code></pre>
  <p>I have tried to convert <code>NUM</code> column into int:</p>
  <pre><code>dataset = dataset.astype({'NUM':'int64'})
  </code></pre>
  <p>But has not effect, so problem in <code>isin</code> on the line:</p>
  <pre><code>filter1 = ~dataset['NUM'].isin(invalidatedNumsDb)
  </code></pre>