title: complex pivot in Python
body: <p>I have a large set of data.
  What I did in Python is:
  I apply the filter first
  Then create a pivot</p>
  <p>However when I check the result, it seems like Python did not perform the data filters. Python only did the pivot table.</p>
  <p>Please advise</p>
  <pre><code>bonds[(bonds['Checkpoint'] == 1) 
        &amp; (bonds['Volcker Desk'] != &quot;FX CASH&quot;)
       &amp; (bonds['Volcker Desk'] != &quot;NMRC&quot;)]
  
  bonds=pd.pivot_table(
      bonds,
      index=['rating'],
      columns=['Bond Type'],
      values=['Holding Amt 1'],
      aggfunc='sum'
  )
  
  bonds
  </code></pre>