title: Python pivot with column values
body: <p>I am new to python and need a help for small pivot function </p>
  
  <p>I have a table with data present in the format above </p>
  
  <pre><code>order_id    primary_dish    primary_cat dish_id order_date  average_adoption
  927852        54438             1         54465   2016-12-11    37.5
  927852        54438             1         54443   2016-12-11    37.5
  927852        54453             1         54453   2016-12-11    25.61
  </code></pre>
  
  <p>Using pandas i have pivoted the above table using dish_id But i want to replace the values which are getting lised as NAN with average_adotion columns which i am not able to do </p>
  
  <p>Currently getting output as below </p>
  
  <pre><code>order_id primary_dish primary_cat   54438   54443   54453   54465
    927852      54438          1       NaN    1.0      1.0    1.0
    927852      54443          1        1.0   NaN      1.0    1.0
    927852      54453          1        1.0   1.0      NaN    1.0
  </code></pre>
  
  <p>Pivot function </p>
  
  <pre><code>dish.pivot_table(index=['order_id', 'primary_dish', 'primary_cat'],
                   columns='dish_id',values=['average_adoption'], aggfunc='size'
                  ).reset_index()
  </code></pre>
  
  <p>Output should look like </p>
  
  <pre><code>order_id primary_dish primary_cat   54438   54443   54453   54465
    927852      54438          1       37.5   1.0      1.0    1.0
    927852      54443          1       1.0    25.61    1.0    1.0
    927852      54453          1       1.0    1.0      25.61  1.0
  </code></pre>