df1 = pd.pivot_table(df, values=['D'], rows=['B'], aggfunc=np.sum)
df2 = pd.pivot_table(df, values=['E'], rows=['B'], aggfunc=np.mean)
pd.concat((df1, df2), axis=1)
define aggfunc for each values column in pandas pivot table