I have a DataFrame with the following structure:
+----------+--------+-------+---------------+
| cash | game |item_id|username |
+-------------------+-------+---------------+
| 0 10.42 | test1 | 131 | my_name_1 |
| 1 4.45 | test2 | 133 | my_name_2 |
| 2 123.2 | test1 | 23 | my_name_1 |
+------------------+--------+---------------+
I need to write a method that takes this DataFrame as input and returns the sum of money each user has spent per game. The output should look like this:
username game
my_name_1 test1 133.62
my_name_2 test2 4.45
Any input on how I can do this is appreciated.