title: Deleting rows with unwanted values in a Dataframe in python
body: <p>I need to drop rows in a dataframe created using panda in Python. I've tried all the different ways mentioned in different forums but nothing seems to work.</p>
  
  <p>I want to delete the rows with ZipCodes more than 5 digits long, so I saw this as an answer:</p>
  
  <pre><code>df = df[len(df.CoulmnName) &lt;5]
  df.head
  </code></pre>
  
  <p>and I get Error: "KeyError: False"
  And I want to iterate through the dataframe to delete rows where there are values greater than 1 in different columns. This is what I tried:</p>
  
  <pre><code>for x in cleandata4bestdeal.columns:
  if x[line] &gt; 1:
     df.drop(df[line])
  </code></pre>
  
  <p>and it doesn't work. I want to iterate through the column headers to remove the rows with values that are not 1's or 0's.</p>