在数据框中:
cart 5000,
checkout 3000,
purchase 2000,
confirmation 1500.
我该怎么做:
Cart =cart+checkout+purchase+confirmation=11500,
Checkout =checkout+purchase+confirmation=6500, Purchase=purchase+confirmation=4500,
confirmation=confirm=1500
我想在如下表格中查看它们:
Cart Checkout Purchase Confirmation
User 11500 6500 4500 1500
答案 0 :(得分:0)
如果您使用python和pandas,请将数据框视为df
for i,val in enumerate(df.columns):
df[val] = df.iloc[:,i:].sum(axis=1)