Bug on pivot_table with margins and dict aggfunc
closes #8349

bug on pandas 0.14.1 pivot_table using dictionary aggfunc and margins.

Test code:

<pre>
<code>
df=pandas.DataFrame([ 
{'JOB':'Worker','NAME':'Bob' ,'YEAR':2013,'MONTH':12,'DAYS': 3,'SALARY': 17}, 
{'JOB':'Employ','NAME':'Mary','YEAR':2013,'MONTH':12,'DAYS': 5,'SALARY': 23}, 
{'JOB':'Worker','NAME':'Bob' ,'YEAR':2014,'MONTH': 1,'DAYS':10,'SALARY':100}, 
{'JOB':'Worker','NAME':'Bob' ,'YEAR':2014,'MONTH': 1,'DAYS':11,'SALARY':110}, 
{'JOB':'Employ','NAME':'Mary','YEAR':2014,'MONTH': 1,'DAYS':15,'SALARY':200}, 
{'JOB':'Worker','NAME':'Bob' ,'YEAR':2014,'MONTH': 2,'DAYS': 8,'SALARY': 80}, 
{'JOB':'Employ','NAME':'Mary','YEAR':2014,'MONTH': 2,'DAYS': 5,'SALARY':190} ])

df=df.set_index(['JOB','NAME','YEAR','MONTH'],drop=False,append=False)

df=df.pivot_table(index=['JOB','NAME'],
columns=['YEAR','MONTH'],
values=['DAYS','SALARY'],
aggfunc={'DAYS':'mean','SALARY':'sum'})
</code>
</pre>


All works fine but raise error using margins:

<pre>
<code>
df=df.pivot_table(index=['JOB','NAME'],
columns=['YEAR','MONTH'],
values=['DAYS','SALARY'],
aggfunc={'DAYS':'mean','SALARY':'sum'},
margins=True)
</code>
</pre>


df=df.pivot_table(index=['JOB','NAME'],columns=['YEAR','MONTH'],values=['DAYS','SALARY'],aggfunc={'DAYS':'mean','SALARY':'sum'},margins=True)
File "/usr/local/lib/python2.7/site-packages/pandas-0.14.1-py2.7-linux-x86_64.egg/pandas/util/decorators.py", line 60, in wrapper
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/pandas-0.14.1-py2.7-linux-x86_64.egg/pandas/util/decorators.py", line 60, in wrapper
return func(_args, *_kwargs)
File "/usr/local/lib/python2.7/site-packages/pandas-0.14.1-py2.7-linux-x86_64.egg/pandas/tools/pivot.py", line 147, in pivot_table
cols=columns, aggfunc=aggfunc)
File "/usr/local/lib/python2.7/site-packages/pandas-0.14.1-py2.7-linux-x86_64.egg/pandas/tools/pivot.py", line 191, in _add_margins
row_margin[k] = grand_margin[k[0]]

KeyError: 'SALARY'

always create the tests first!

you can use the test example you gave, put in `pandas/tools/tests/test_pivot.py` where the other margin items are calculated.
 Did it, sorry for all, this is my first time.
 ok, see docs here: https://github.com/pydata/pandas/wiki

no need to create a new PR for this.

just add a commit.
 need a release note in v0.15.0 (bug fix section). and pls squash. ping when done.
 Bug fix note added.
 gr8. can you squash? https://github.com/pydata/pandas/wiki/Using-Git
 uff... it was hard.
Hope all is ok now.
 merged via https://github.com/pydata/pandas/commit/4074957c0933893afcb2ec785fcba6520789c1df
 thanks!
