0

I have a dataframe that looks like this:

Publisher   Week End Date   Cost
A   1/4/2020    302.4242948
A   1/11/2020   527.256899
A   1/18/2020   54.75997765
A   1/25/2020   378.5780062
A   2/1/2020    189.8760722
C   2/8/2020    212.1528952
A   2/15/2020   218.2095771
E   1/4/2020    1
D   1/11/2020   1
B   1/18/2020   1

I want to reverse-flatten it so that for each Publisher, a new Cost column is generated. So the output would look like this:

Week End Date   A Cost  B Cost  C Cost  D Cost  E Cost
1/4/2020    302.4242948             
1/11/2020   527.256899              
1/18/2020   54.75997765             
1/25/2020   378.5780062             
2/1/2020    189.8760722             
2/8/2020            212.1528952     
2/15/2020   218.2095771             
1/4/2020                    1
1/11/2020               1   
1/18/2020       1           

How do I do this in Python?

dataelephant
  • 563
  • 2
  • 7
  • 21

0 Answers0