行处理——运算
基于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,包含若干求和后数值。