IIU C вам нужно просто groupby
+ agg
как следует
df = pd.DataFrame({"ReceiptID": [123,123,125,125],
"ItemName": ["Black Shoe", "Broen Shoe", "Sandal", "Peshawari"],
"Category": ["Shoes", "Shoes", "Sandal" ,"Shoes"],
"NetQty": [5,4,2,1]})
out = df.groupby("ReceiptID")\
.agg({"ItemName":"unique",
"Category":"unique",
"NetQty":"sum"})\
.reset_index()
ReceiptID ItemName Category NetQty
0 123 [Black Shoe, Broen Shoe] [Shoes] 9
1 125 [Sandal, Peshawari] [Sandal, Shoes] 3
Если вы хотите просто строки вместо списков, вы можете добавить эти две строки
for col in ["ItemName", "Category"]:
out[col] = out[col].str.join(", ")
ReceiptID ItemName Category NetQty
0 123 Black Shoe, Broen Shoe Shoes 9
1 125 Sandal, Peshawari Sandal, Shoes 3