Restructure data frame through aggregation

Since you have experience with python I think you are familiar with the concept of a minimal reproducible example, could you please turn this into one?

In the meanwhile, you can take a look into tibbletime package for time aggregation and, into tidyr package for gathering your data into a wide format.