title: Delete rows < x to create plot in Pandas
body: <p>I have a dataframe like this in a .csv:</p>
  
  <pre><code>Consequence,N_samples
  A,227
  B,413
  C,194
  D,1
  E,1610
  F,10
  G,7
  H,1
  I,1
  J,5
  K,1
  L,5
  M,5
  N,30
  O,7
  P,3
  </code></pre>
  
  <p>And I want to make a plot pie out of it, but grouping all values lower than 150 into "Other" category. I've tried running this code but it's not working.</p>
  
  <pre><code>import pandas as pd
  %matplotlib inline
  import matplotlib.pyplot as plotother = {'Consequence' : 'Other', 'N_samples':0}
  df=pd.read_csv('df.csv', sep=',')
  df = df.append(other,ignore_index=True)
  for i in df:
    if (x in df['N_samples']) &lt; 150:
         df['N_samples'].iloc[-1]=df['N_samples'].iloc[-1] + (x in df['N_samples'])
         df.drop([x])
  df.plot.pie(label="", title="Consequence", startangle=90);
  plot.savefig('Consequence.svg')
  </code></pre>
  
  <p>Once I run it I get the following error:</p>
  
  <pre><code>KeyError: "['Consequence'] not found in axis"
  </code></pre>
  
  <p>I would really appreciate any help.</p>