My dataframe looks like this:
timestamp side price amount fee
0 2018-12-14 13:00:00 buy 0.00338508 5 0.005
1 2018-12-14 13:00:00 buy 0.00337829 5 0.005
2 2018-12-14 14:00:00 buy 0.00338089 5 0.005
3 2018-12-14 14:00:00 buy 0.00338079 1 0.001
4 2018-12-14 15:00:00 sell 0.00338838 8 0.00002711
5 2018-12-14 15:00:00 sell 0.00339132 8 0.00002713
6 2018-12-14 15:00:00 buy 0.00337999 5 0.005
7 2018-12-14 16:00:00 sell 0.00339373 5 0.00001697
What I need to do is to create a column which would sum the values of the column 'amount' which have the same timestamp. So for the timestamp 2018-12-14 13:00:00
the new column would look like this:
timestamp side price amount fee sum
0 2018-12-14 13:00:00 buy 0.00338508 5 0.005 10
1 2018-12-14 13:00:00 buy 0.00337829 5 0.005 10
I tried with the following code: df_statistics_hour['traded_volume'] = float(df_statistics_hour['amount'].sum())
but of course there is the same value in each cell of the new column, any idea on how to proceed? Thanks!