行处理——运算

基于pandas

  • 求和。
column_list = ['Fiber_TD_(g)', 'Sugar_Tot_(g)']
# Let's sum up the total amount of fiber and sugar across all the foods.
total = food_info[column_list].sum(axis=0)
# result has two values, one is the taotal fiber of all foods, the other is the total sugar of all foods

 输入:dataframe,输出:行vector,包含若干求和后数值。

posted on 2016-01-13 23:52  arsh  阅读(264)  评论(0编辑  收藏  举报

导航