0

If I have a DataFrame like this:

Day Hour   G
  1  0     1  
  1  1     10
  1  2     20
  1  3      2
  1  4      3
  .. ..
  1  23    10
  2  0      2
  2  1      3
  .. ..     ..

If I would get an array like this (without for loop):

     1 1 10 20 2 3 ...
     2 2 3 .. ........

that is: take groups of 23 values and transform each group in a column vector in such a way I'll have N column vectors each of 23 values. In other words: the row index is the Day (1,2,3...) and the columns for every rows are the values of the column G. In more details: if I have one big column vector of 356x23 values (one value for every hour in the year) I would like to get a 2D vector with 356 rows and 23 columns.

Which is the best technique in pandas/python/numpy?

gdm
  • 7,647
  • 3
  • 41
  • 71

0 Answers0