I have the following dataframe:
df=pd.DataFrame(index=[0,1])
df['timestamp'] = ['2022-01-01 20:10:00', '2022-01-01 20:50:00']
df['currency'] = ['USD', 'USD']
df['operation'] = ['deposit', 'deposit']
df['amount'] = [0.1, 0.4]
df:
timestamp currency operation amount
0 2022-01-01 20:10:00 USD deposit 0.1
1 2022-01-01 20:50:00 USD deposit 0.4
How can I resample the data on an hourly basis and sum the "amount" to get the following dataframe:
df:
timestamp currency operation amount
0 2022-01-01 20:00:00 USD deposit 0.5
Using .resample('H')
eliminates the currency and operation columns. How can I do this so that Sum the "amount" column?