-1

I have a data frame similar to the one below

    date       store    load0   load30  load100 load130 load200
0   2021-12-1   450         0      1       1       1       1
1   2021-12-2   450         0      1       1       0       1
2   2021-12-1   650         0      0       1       0       1
3   2021-12-2   650         0      1       0       0       0

I want to decompose/merge all the rows related to one particular store(say 450) into a single row. I want this to be done for all the stores present in my data frame.

Simply put, i want only one row per store regardless of any number of dates

Sample output, I am looking for

enter image description here

I tried pandas unstacking() and melt() functions, but nothing helped me in getting the desired output format.

Any help would be appreciated, Thanks in advance!

0 Answers0