您需要删除
df:
#here df.pivot_table(df,index = ['A','B'], values = 'D',columns = 'C', aggfunc = 'sum')
a = df.pivot_table(index = ['A','B'], values = 'D',columns = 'C', aggfunc = 'sum')print (a)C large smallA B bar one 4.0 5.0 two 7.0 6.0foo one 4.0 1.0 two NaN 6.0



