TypeError: pivot_table() got multiple values for keyword argument 'values'

后端 未结 1 1461
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-12 04:47

I am using Python2.7. I am learning pandas and was implementing pivot_table. While implementing the example given in pivot_table documentation :

    raw_dat         


        
相关标签:
1条回答
  • 2021-01-12 05:05

    You need remove 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  small
    A   B                
    bar one    4.0    5.0
        two    7.0    6.0
    foo one    4.0    1.0
        two    NaN    6.0
    
    0 讨论(0)
提交回复
热议问题