Compute row average in pandas

前端 未结 4 1837
走了就别回头了
走了就别回头了 2020-11-28 08:14
       Y1961      Y1962      Y1963      Y1964      Y1965  Region
0  82.567307  83.104757  83.183700  83.030338  82.831958  US
1   2.699372   2.610110   2.587919   2.         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 09:01

    If you are looking to average column wise. Try this,

    df.drop('Region', axis=1).apply(lambda x: x.mean())
    
    # it drops the Region column
    df.drop('Region', axis=1,inplace=True)
    

提交回复
热议问题