title: sum of rows/columns/total appended in pivot
body: <p>I am using the below pivot_table command to meet my requirement of having the result in the following format</p>
  
  <pre><code>active_def = pd.pivot_table(data, index = 'InMonth', columns= 'OutMonth', aggfunc= 'count')['ID']
  </code></pre>
  
  <p>I need a column  towards the end of pivot table having the row totals.  Similarly a row towards the end having the column totals and one cell having sum of all the values in a table. (In simple words, similar to the pivot we usually get in excel).  Is there pythonized way to do it?  I know we can use <code>data.sum(axis=0/1)</code> to obtain individually, but, I am looking for a better way to do it.</p>
  
  <p>Thanks!</p>
  
  <p><a href="https://i.stack.imgur.com/TB9gv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TB9gv.png" alt="pivot table results"></a></p>