I have the below data :
So for each device there is hours data across 10 channels for Sep, Oct and Nov and these need to be summed up while pivoting on device_id and hence the output will be as shown in the second part of image.
Here is the data in text format:
device_id month_id channel hours brand
214 201711 A 2.311 S
214 201710 A 6.071 S
214 201709 A 0.55 S
214 201711 B 0.603 S
214 201710 B 2.185 S
214 201709 B 2.62 S
214 201711 C 0.82 S
214 201710 C 25.70 S
214 201709 C 17.73 S
Output:
device_id A B C brand
214 8.933054 5.412499 44.261665 S
All the data is in a pandas dataframe and I want to use pivot for this.Can someone please help me with this?