0

I have a dataframe :

    Date of purchase         Price          Item code
0   2022-03-30               43.43          ZS144
1   2022-03-31               43.04          ZS144
2   2022-01-04               42.81          ZS144
3   2022-04-04               43.14          ZS144
4   2022-05-04               43.11          ZS144
5   2022-03-30               41.89          ZS250
6   2022-03-31               41.89          ZS250
7   2022-03-31                41.97         ZS350

I want to reshape this dataframe and be like:

    Date of purchase             ZS144      ZS250   ZS350                    ...
0   2022-03-30                   43.43      41.89   NAN
1   2022-03-31                   43.04      41.89   41.97
2   2022-01-04                   42.81       ...
3   2022-04-04                   43.14  
4   2022-05-04                   43.11       ...     ...
                
                

So I have multiple Dates of purchase, multiple item codes and multiple prices. I want to have per item code the date and the price. Could you please help me? I tried the pivot function but with no aggregation and multiple values is not working.

zeromath
  • 1
  • 1

0 Answers0