title: Iterating through rows in dataframe to compare values to mean
body: <p>I have a large pandas dataframe, df, that includes crime statistics.  The columns are the category of crime (i.e., ARSON, ASSAULT, BAD CHECKS, GRAND THEFT, etc.).  The rows are the addresses where the crimes occurred.</p>
  
  <p>The values in each cell are the number of times that each category of crime occurred at that address.</p>
  
  <p>I need to write a function that iterates through each row of hte dataframe, compares the value to the MEAN number of crimes for each category, and then identifies only those addresses where the number of crimes exceeds the mean.</p>
  
  <p>Here is my code so far:</p>
  
  <pre><code>import pandas as pd
  import csv
  crimeData = open("crimeData.csv")
  df = pd.read_csv('crimeData.csv')
  df = df.set_index ('Address')
  mean = df.mean(axis=0)
  #this gives me the mean for each Crime Category
  for index, row in df.iterrows():
      if row &gt; mean:
          print (index)
  </code></pre>
  
  <p>This is not working.  I get the following error:</p>
  
  <p>ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().</p>
  
  <p>Where am I going wrong?  How can I get it to a) identify which crime categories at each address occur more than the mean, and b) print the address along with the categories of crime that exceed the mean into a list?</p>