title: Pandas Pivot table aggfunc countif condition
body: <p>I am trying to make a pivot table of dataset Docs that counts the number of 'DocuNum' and count if only 'DaysBetween' column is less than 30.  My pivot table should have two columns.  Count of 'DocNum' and count of 'Days Between' less than 30.  </p>
  
  <pre><code>DocsPivot = pd.pivot_table(Docs, index = ['Study'], values = ['DocNum', 
              'DaysBetween'],  
              aggfunc ={'DocNum':len, 'DaysBetween':lambda x: x&lt;30})
  </code></pre>
  
  <p>Expected Result</p>
  
  <pre><code>TEST    DocNum  DaysBetween 
  101 4158    365
  203 1958    325
  105 1019    243
  201 11922   1045
  204 1067    56
  301 2690    265
  </code></pre>