<p>我有下面的.csv</p>
<pre><code> Name Location Product Type number
Greg 1 Fruit grape 1
Greg 1 Fruit apple 2
Greg 1 Bakery bread 5
Greg 1 Bakery roll 8
Greg 2 Fruit grape 7
Greg 2 Fruit apple 1
Greg 3 Fruit grape 2
Greg 4 Bakery roll 3
Greg 4 Bakery bread 4
Sam 5 Fruit apple 7
Sam 5 Fruit grape 9
Sam 5 Fruit apple 10
Sam 6 Bakery roll 11
Sam 6 Bakery bread 12
Sam 7 Fruit orange 13
Sam 7 Bakery roll 14
Tim 8 Fruit bread 16
Zack 9 Bakery roll 17
Zack 10 Fruit apple 19
Zack 10 Fruit grape 20
</code></pre>
<p>我想按名称将其分为熊猫和大熊猫组,在多个地点有两种以上的产品。我仍然希望保留产品的“编号”</p>
<p>例如,位置1的Greg有两个产品</p>
<pre><code>name location product type
Greg 1 Fruit, bakery grape,apple,bread,roll
</code></pre>
<p>我正在与groupby进行斗争,并最终将其恢复到一个我可以使用的数据框架中</p>