title: generic function for conditional filtering in pandas dataframe
body: <p>sample filtering condition:-</p>
  
  <p><a href="https://i.stack.imgur.com/AMSBB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AMSBB.png" alt="enter image description here"></a>
  Data</p>
  
  <pre><code>x  y  z 
  1  2  1
  1  3  2
  1  2  5
  1  3  1
  </code></pre>
  
  <p>now i want to filter the above specified condition from the given data.
  for that i need a generic function, i.e, that function should be work for any filters not only for the above specified filters.</p>
  
  <p>I know how to filter data manually in python for more than one condition.</p>
  
  <p>I think generic function may be needed two arguments one is data and another one is filtering condition.</p>
  
  <p>But I am unable to found the logic for write the generic function to filter the data.</p>
  
  <p>Kindly anyone can help me to tackle.</p>
  
  <p>Thanks in advance.</p>