I'm working on a dataset that has the following simplified structure:
SKU | Store code | sales |
---|---|---|
1 | A432 | 123 |
2 | B123 | 456 |
1 | C234 | 098 |
So far I created another dataframe that groups the records by SKU and the sum of sales, but there are other fields aggregated using other methods.
How could I add columns for Sales at A, Sales at B and Sales at C.
So far I have tried working with the standard creation of columns using loc to filter the data, but i haven't being successful iterating over the SKUs
The output that I'm looking for is:
SKU | sales | A | B | C |
---|---|---|---|---|
1 | 123 | 201 | 15 | 0 |
2 | 456 | 456 | 7 | 150 |