对pandas数据框中的列执行操作并存储在新列中

时间:2017-02-08 16:23:45

标签: pandas

df['TotalCost_BRL'] = df['COM/CHEESE_BRL_weekly'] * df['Barrel_Vol' ]
df['TotalCost_BLK'] = df['COM/CHEESE_BLK_weekly'] * df['Butter_Vol']
df['TotalCost_BUTTER'] = df['COM/BUTTER_weekly'] * df['Butter_Vol']
df['TotalCost_NFDM'] = df['COM/MILK_weekly'] * df['NFDM_Vol' ]
df['TotalCost_Whey'] = df['COM/WHEY_weekly'] * df['Whey_Vol']

我想在数据框的for循环上执行此操作,索引为日期和列,如上面的语句中所述。基本上我试图将右边的某些列相乘并将它们保存在左边提到的新列中。有人可以帮帮我吗?我很无能

0 个答案:

没有答案