0

I have a panda's dataframe with the following structure:

    Date        product  count
0   2016-09-01  sugar    3   
1   2016-09-01  pasta    4   
2   2016-09-01  coffee   5   
3   2016-09-02  sugar    25  
4   2016-09-02  pasta    30   
5   2016-09-02  salad    5

I would like to obtain the unaggregated data (like the picture below), but I don't know how to achieve it using pandas. In apache spark it would be easier, I could use explode after some trivial transformations.

    Date        product  
0   2016-09-01  sugar
1   2016-09-01  sugar
2   2016-09-01  sugar
3   2016-09-01  pasta
.   .           .
.   .           .
.   .           .
?   2016-09-02  salad
Alberto Bonsanto
  • 17,556
  • 10
  • 64
  • 93

0 Answers0