Get total of Pandas column

前端 未结 5 585
予麋鹿
予麋鹿 2020-11-30 18:58

Target

I have a Pandas data frame, as shown below, with multiple columns and would like to get the total of column, MyColumn.<

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 19:33

    Similar to getting the length of a dataframe, len(df), the following worked for pandas and blaze:

    Total = sum(df['MyColumn'])
    

    or alternatively

    Total = sum(df.MyColumn)
    print Total
    

提交回复
热议问题