I have a python pandas dataframe named 'Red' with two columns TimeStamp and Red. The index is already set to TimeStamp. Sum() is applied but it aggregated on second based. I need to aggregate on Hourly, Weekly and monthly base. Plz guide, thanks
In [56]: Red.columns 
Out[56]: Index(['TimeStamp', 'Red'], dtype='object') 
In [64]: Red.shape , type(Red) 
Out[64]: ((1381701, 2), pandas.core.frame.DataFrame) 
In [69]: Red.head(5) 
Out[69]: 
       TimeStamp      Red 
0 2017-05-01 00:00:01  1  
1 2017-05-01 00:00:01  1 
2 2017-05-01 00:00:01  1 
3 2017-05-01 00:00:01  1 
4 2017-05-01 00:00:01  1 
In [70]: Red.groupby('TimeStamp').sumfthead(3)
Out[70]:  
      TimeStamp      Red
2017-05-01 00:00:01  16 
2017-05-01 00:00:02  16 
2017-05-01 00:00:03  16  
 
     
    