Ι get a large datasheet from SAP like the following one
SKU | Warehouse Num | Available Stock | ..... |
---|---|---|---|
001 | 1 | 45 | |
001 | 2 | 0 | |
001 | 3 | 6 | |
002 | 1 | 9 | |
002 | 2 | 32 | |
002 | 3 | 7 |
And I want to create a new data frame using pandas that keeps unique SKU numbers and moves available stock from columns to specific rows. The data frame I want to create should look like the one below.
SKU | Warehouse 001 | Warehouse 002 | Warehouse 003 | ..... |
---|---|---|---|---|
001 | 45 | 0 | 6 | |
002 | 9 | 32 | 7 |
I tried using df.pivot_table
but couldn't get it working properly. Can anyone help me with that?