title: Odd dropping of pandas rows based on conditions
body: <p>I use the function:</p>
  
  <pre><code>def df_proc(df, n):
      print (list(df.lab).count(0)) # control label to see if it changes after conditional dropping
      print ('C:', list(df.lab).count(1))
  
      df = df.drop(df[df.lab.eq(0)].sample(n).index)
  
      print (list(df.lab).count(0))
      print ('C:', list(df.lab).count(1))
  
      return df
  </code></pre>
  
  <p>To drop pandas rows based on certain conditions (where df.lab == 0). This works fine on a small df (e.g. n = 100) however when I increase the number of rows in the df something odd happens ... the counts of other labels (!= 0) also begin to decrease and are affected by the condition.. </p>
  
  <p>For example:</p>
  
  <pre><code># dummy example:
  import random
  list2 = [random.randrange(0, 6, 1) for i in range(1500000)] 
  list1 = [random.randrange(0, 100, 1) for i in range(1500000)] 
  dft = pd.DataFrame(list(zip(list1, list2)), columns = ['A', 'lab'])
  dftest = df_proc(dft,100000)
  </code></pre>
  
  <p>gives...</p>
  
  <pre><code>249797
  C: 249585
  149797
  C: 249585
  </code></pre>
  
  <p>But when I run this on my actual df:</p>
  
  <pre><code>dftest = df_proc(S1,100000)
  </code></pre>
  
  <p>I get a change in my control labels which is weird.</p>
  
  <pre><code>467110
  C: 70434
  260616
  C: 49395
  </code></pre>
  
  <p>I'm not sure where the error could have come from. I have tried using <code>frac</code> and <code>df.query('lab == 0')</code> but still run into the same error. The other thing I noticed is that with small <code>n</code> the control labels are unchanged, its only when I increase <code>n</code>. </p>
  
  <pre><code>dftest = df_proc(S1,1)
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>467110
  C: 70434
  467107
  C: 70434
  </code></pre>
  
  <p>Which doesnt add up as 3 samples have been removed not 1.</p>