AmazonData Scientist · OnsiteCodemia practiceAllocate Order Shipping Cost to Line Items Without Losing a Cent
Each shipment has one shipping cost in cents, but finance needs cost at the order line level. Given lines (order_id, line_id, weight_kg) and shipments (order_id, ship_cost_cents), use pandas to allocate each order's cost to its lines in proportion to weight, in whole cents, so that line amounts sum exactly to the order cost.
Hard
Data Manipulation (SQL/Python)