title: pandas: Is it possible to filter a dataframe with arbitrarily long boolean criteria?
body: <p>If you know exactly how you want to filter a dataframe, the solution is trivial:</p>
  
  <p><code>df[(df.A == 1) &amp; (df.B == 1)]</code></p>
  
  <p>But what if you are accepting user input and do not know beforehand how many criteria the user wants to use? For example, the user wants a filtered data frame where columns [A, B, C] == 1. Is it possible to do something like:</p>
  
  <pre><code>def filterIt(*args, value):
      return df[(df.*args == value)]
  </code></pre>
  
  <p>so if the user calls <code>filterIt(A, B, C, value=1)</code>, it returns:</p>
  
  <pre><code>df[(df.A == 1) &amp; (df.B == 1) &amp; (df.C == 1)]
  </code></pre>