title: Groupby and any() | all()
body: <p>I have the following <code>pd.DataFrame</code></p>
  
  <pre><code>In [155]: df1
  Out[155]: 
     ORDER_ID    ACQ       DATE UID
  2         3  False 2014-01-03   1
  3         4   True 2014-01-04   2
  4         5  False 2014-01-05   3
  6         7   True 2014-01-08   5
  7         8  False 2014-01-08   5
  9        10  False 2014-01-10   6
  0        11  False 2014-01-11   6
  </code></pre>
  
  <p>where each entry is an order, with values for <code>ORDER_ID</code>, <code>DATE</code>, <code>UID</code> and <code>ACQ</code> (indicates whether this is the first order for the associated <code>UID</code> in the dataset).</p>
  
  <p>I am trying to filter and keep all orders that were placed by users that have made their first order inside the time period covered in the dataset (i.e. at least one of the orders of such users satisfy <code>ACQ == True</code>).</p>
  
  <p>So, the desired output would be:</p>
  
  <pre><code>   ORDER_ID    ACQ       DATE UID
  3         4   True 2014-01-04   2
  6         7   True 2014-01-08   5
  7         8  False 2014-01-08   5
  </code></pre>
  
  <p>and I have managed to reach this by:</p>
  
  <pre><code>In [156]: df1.groupby('UID').filter(lambda x: x.ACQ.any() == True)
  Out[156]: 
     ORDER_ID    ACQ       DATE UID
  3         4   True 2014-01-04   2
  6         7   True 2014-01-08   5
  7         8  False 2014-01-08   5
  </code></pre>
  
  <p>However, when I try to find all the orders that were placed by users that have made their first order outside the time period covered in the dataset (i.e. All their orders should satisfy <code>ACQ == False</code>) I seem to be lost. I have tried this:</p>
  
  <pre><code>In [159]: df1.groupby('UID').filter(lambda x: x.ACQ.all() == False)
  Out[159]: 
     ORDER_ID    ACQ       DATE UID
  2         3  False 2014-01-03   1
  4         5  False 2014-01-05   3
  6         7   True 2014-01-08   5 ## &lt;- This order is an acquisition, therefore all orders with UID == 5 should be filtered out.
  7         8  False 2014-01-08   5
  9        10  False 2014-01-10   6
  0        11  False 2014-01-11   6
  </code></pre>
  
  <p>How should I go about filtering out all the orders placed by users that have ALL their orders satisfy <code>ACQ == False</code>?</p>
  
  <p>Any ideas are very much appreciated, thanks!</p>