title: Getting the row and column numbers that meets multiple conditions in Pandas
body: <p>I am trying to get the <code>row</code> and <code>column</code> number, which meets three conditions in Pandas DataFrame.</p>
  
  <p>I have a DataFrame of <code>0</code>, <code>1</code>, <code>-1</code> (bigger than <code>1850</code>); when I try to get the <code>row</code> and <code>column</code> it takes forever to get the output.</p>
  
  <p>The following is an example I have been trying to use:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  a = pd.DataFrame(np.random.randint(2, size=(1845,1850)))
  
  b = pd.DataFrame(np.random.randint(2, size=(5,1850)))
  b[b == 1] = -1
  
  c = pd.concat([a,b], ignore_index=True)
  
  column_positive = []
  row_positive = []
  
  column_negative = []
  row_negative = []
  
  column_zero = []
  row_zero = []
  
  for column in range(0, c.shape[0]):
      for row in range(0, c.shape[1]):
          if c.iloc[column, row] == 1:
              column_positive.append(column)
              row_positive.append(row)
          elif c.iloc[column, row] == -1:
              column_negative.append(column)
              row_negative.append(row)
          else:
              column_zero.append(column)
              row_zero.append(row)
  </code></pre>
  
  <p>I did some web searching and found that <code>np.where()</code> does something like this, but I have no idea how to do it.</p>
  
  <p>Could anyone tell a better alternative?</p>