title: How to get pandas dataframe series name given a column value?
body: <p>I have a python pandas dataframe with a bunch of names and series, and I create a final column where I sum up the series. I want to get just the row name where the sum of the series equals 0, so I can then later delete those rows. My dataframe is as follows (the last column I create just to sum up the series):</p>
  
  <pre><code>      1   2   3   4  total
  Ash   1   0   1   1  3
  Bel   0   0   0   0  0
  Cay   1   0   0   0  1
  Jeg   0   1   1   1  3
  Jut   1   1   1   1  4
  </code></pre>
  
  <p>Based on the last column, the series "Bel" is 0, so I want to be able to print out that name only, and then later I can delete that row or keep a record of these rows.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>def check_empty(df):
      df['total'] = df.sum(axis=1) # create the 'total' column to find zeroes
      for values in df['total']:
          if values == 0:
              print(df.index[values)
  </code></pre>
  
  <p>But this obviously is wrong because I am passing the index of 0 to this loop, which will always print the name of the first row. Not sure what method I can implement here though?</p>
  
  <p>There are great solutions below and I also found a way using a simpler python skill, enumerate (because I still find list comprehension hard to write):</p>
  
  <pre><code> def check_empty(df):
       df['total'] = df.sum(axis=1)
       for name, values in enumerate(df['total']):
           if values == 0:
              print(df.index[name])
  </code></pre>