我想根据列中的值创建多个数据帧.
样本数据
Run Code Online (Sandbox Code Playgroud)df Index Product ID Amount 200 Prod1 01 100 201 Prod1 01 150 202 Prod1 01 123 203 Prod1 01 123 204 Prod1 02 110 205 Prod1 02 175 206 Prod1 02 190 207 Prod2 03 120 208 Prod2 03 135 209 Prod2 03 150
我想为每个ID添加一列作为Base.Base的值是每个ID中的第一个金额值.
>df1
Index Product ID Amount Base
200 Prod1 01 100 100
201 Prod1 01 150 100
202 Prod1 01 123 100
203 Prod1 01 123 100
204 Prod1 02 110 110
205 …Run Code Online (Sandbox Code Playgroud)