title: Fastest ways to filter for values in pandas dataframe
body: <p>A similar dataframe can be created:</p>
  <pre><code>import pandas as pd
  
  df = pd.DataFrame()
  df[&quot;nodes&quot;] = list(range(1, 11))
  df[&quot;x&quot;] = [1,4,9,12,27,87,99,121,156,234]
  df[&quot;y&quot;] = [3,5,6,1,8,9,2,1,0,-1]
  df[&quot;z&quot;] = [2,3,4,2,1,5,9,99,78,1]
  
  df.set_index(&quot;nodes&quot;, inplace=True)
  </code></pre>
  <p>So the dataframe looks like this:</p>
  <pre><code>        x        y        z
  nodes
  1       1        3        2
  2       4        5        3
  3       9        6        4
  4       12       1        2
  5       27       8        1
  6       87       9        5
  7       99       2        9
  8       121      1        99
  9       156      0        78
  10      234      -1       1
  </code></pre>
  <p>My first try for searching e.g. all nodes containing number 1 is:</p>
  <pre><code>&gt;&gt;&gt; df[(df == 1).any(axis=1)].index.values
  [1 4 5 8 10]
  </code></pre>
  <p>As i have to do this for many numbers and my real dataframe is much bigger than this one, i'm searching for a very fast way to do this.</p>