title: Check if a row exists in pandas
body: <p>I want to check if a row exists in dataframe, following is my code:</p>
  
  <pre><code>df = pd.read_csv('dbo.Access_Stat_all.csv',error_bad_lines=False, usecols=['Name','Format','Resource_ID','Number'])
  df1 = df[df['Resource_ID'] == 30957]
  df1 = df1[['Format','Name','Number']]
  df1 = df1.groupby(['Format','Name'], as_index=True).last()
  pd.options.display.float_format = '{:,.0f}'.format
  df1 = df1.unstack()
  df1.columns = df1.columns.droplevel()
  if 'entry' in df1:
      df2 = df1[1:4].sum(axis=0)
  else:
      df2 = df1[0:3].sum(axis=0)
  df2.name = 'sum'
  df2 = df1.append(df2)
  print(df2)
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>Name    Apr 2013  Apr 2014  Apr 2015  Apr 2016  Apr 2017  Aug 2010  Aug 2013  
  Format                                                                         
  
  entry          0         0         0         1         4         1         0   
  pdf           13        12         4        23         7         1         9   
  sum           13        12         4        24        11         2         9 
  </code></pre>
  
  <p>Does <b> if 'entry' in df2: </b> only check if 'entry' exists as a column? It must be the case, I guess. We can see that the row 'entry' exists but we still land in the else condition(if it had landed in if the statement sum for Apr 2016 would be 23).</p>
  
  <p>If I check it for the file which don't have the row 'entry', it again lands in else statement(as I expect), so I assume it always enters the else condition.</p>
  
  <p>How do I check if a row exists in pandas?</p>