I have data with 3 locations. I would like to group by my locations and create new pandas DataFrame.
I have pandas DataFrame as follows:
Day Time LocationA LocationB
1 8 XX YY
1 8 XX ZZ
1 8 XX ZZ
1 9 YY ZZ
1 9 XX YY
1 9 ZZ XX
1 9 ZZ YY
2 8 XX ZZ
2 8 XX YY
I need pandas DataFrame as follows:
Day Time Location A B
1 8 XX 3 0
1 8 YY 0 1
1 8 ZZ 0 2
1 9 XX 1 1
1 9 YY 1 2
1 9 ZZ 2 1
2 8 XX 2 0
2 8 YY 0 1
2 8 ZZ 0 1