i have a pandas dataframe suchs as:
Price Category Product
4/11/2021 12 S1 ABC
4/12/2021 15 S1 ABC
4/13/2021 13 S2 ABC
4/14/2021 14 S3 ABC
4/11/2021 12 S1 CDE
4/12/2021 15 S1 CDE
4/13/2021 13 S2 CDE
4/14/2021 14 S3 CDE
4/11/2021 12 S1 FGH
4/12/2021 15 S1 FGH
4/13/2021 13 S2 FGH
4/14/2021 14 S3 FGH
and i would like to transform it to a shorter table so the result would like like:
ABC CDE FGH
4/11/2021 S1 S1 S1
4/12/2021 S1 S1 S1
4/13/2021 S2 S2 S2
4/14/2021 S3 S3 S3
NOte that the price column is not included.
In R i would use a dcast
function but in Python i not know how to do it. I tried a 2-level loop and it is a disaster.
Anybody know a quick way in Python please?