Aggregating Dataframe in groups of 3

Viewed 44

I have a DataFrame like this one :

           date        open        high         low       close        vwap
0    1498907700  0.00010020  0.00010020  0.00009974  0.00010019  0.00009992   
1    1498908000  0.00010010  0.00010010  0.00010010  0.00010010  0.00010010   
2    1498908300  0.00010010  0.00010010  0.00009957  0.00009957  0.00009992   
3    1498908600  0.00009957  0.00009957  0.00009957  0.00009957  0.00000000   
4    1498908900  0.00010009  0.00010009  0.00009949  0.00009959  0.00009952   
5    1498909200  0.00009987  0.00009991  0.00009956  0.00009956  0.00009974   
6    1498909500  0.00009948  0.00009948  0.00009915  0.00009915  0.00009919 
...
789

And would like to do a mean of each 3 rows and have a new DataFrame which is then 3 times shorter with the mean of all sets of 3 rows inside the source DataFrame.

1 Answers
Related