Add column to the end of Pandas DataFrame containing average of previous data

前端 未结 4 1276
深忆病人
深忆病人 2021-02-12 14:04

I have a DataFrame ave_data that contains the following:

ave_data

Time        F7           F8            F9  
00:00:00    43.005593    -56.509746           


        
4条回答
  •  [愿得一人]
    2021-02-12 14:31

    @LaangeHaare or anyone else who is curious, I just tested it and the copy part of the accepted answer seems unnecessary (maybe I am missing something...)

    so you could simplify this with:

    df['average'] = df.mean(numeric_only=True, axis=1)
    

    I would have simply added this as a comment but don't have the reputation

提交回复
热议问题