df=pd.DataFrame({'Region':['Oceanian','Europe','Asia','America','Europe','America','Asia','Oceanian','America'],'Country':["AU","GB","KR","US","GB","US","KR","AU","US"],'Region Manager':['TL','JS','HN','AL','JS','AL','HN','TL','AL'],'Campaign Stage':['Start','Develop','Develop','Launch','Launch','Start','Start','Launch','Develop'],'Product':['abc','bcd','efg','lkj','fsd','opi','vcx','gtp','qwe'],'Curr_Sales': [453,562,236,636,893,542,125,561,371],'Curr_Revenue':[4530,7668,5975,3568,2349,6776,3046,1111,4852],'Prior_Sales': [235,789,132,220,569,521,131,777,898],'Prior_Revenue':[1530,2668,3975,5668,6349,7776,8046,2111,9852]})table=pd.pivot_table(df, values=['Curr_Sales', 'Curr_Revenue', 'Prior_Sales', 'Prior_Revenue'], index=['Region','Country', 'Region Manager','Campaign Stage','Product'],aggfunc='sum')如何为每个“区域”添加小计,并在底部添加总计?任何想法表示赞赏!谢谢你。
添加回答
举报
0/150
提交
取消