title: how to aggregate in pivot table in pandas
body: <p>I have following dataframe in pandas</p>
  
  <pre><code>   code     date         tank      nozzle       qty      amount
     123      2018-01-01   1         1            100      0
     123      2018-01-01   1         2            0        50
     123      2018-01-01   1         2            0        50
     123      2018-01-01   1         2            100      0 
     123      2018-01-02   1         1            0        70
     123      2018-01-02   1         1            0        50
     123      2018-01-02   1         2            100      0
  </code></pre>
  
  <p>My desired dataframe is</p>
  
  <pre><code>code   date       tank     nozzle_1_qty   nozzle_2_qty  nozzle_1_amount   nozzle_2_amount
  123   2018-01-01  1        100             100          0                 100
  123   2018-01-02  1        0               100          120               0 
  </code></pre>
  
  <p>I am doing following in pandas..</p>
  
  <pre><code>df= (df.pivot_table(index=['date', 'tank'], columns='nozzle',
                       values=['qty','amount']).add_prefix('nozzle_')
           .reset_index()
        )
  </code></pre>
  
  <p>But,this does not give me my desired output.</p>