I'm currently working on a mock analysis of a mock MMORPG's microtransaction data. This is an example of a few lines of the CSV file:
PID Username    Age Gender ItemID   Item Name   Price
0   Jack78      20  Male    108    Spikelord    3.53
1   Aisovyak    40  Male    143  Blood Scimitar 1.56
2   Glue42      24  Male    92   Final Critic   4.88
Here's where things get dicey- I successfully use the groupby function to get a result where purchases are grouped by the gender of their buyers.
test = purchase_data.groupby(['Gender', "Username"])["Price"].mean().reset_index()
gets me the result (truncated for readability)
                    Gender        Username  Price
0                   Female     Adastirin33  $4.48
1                   Female   Aerithllora36  $4.32
2                   Female      Aethedru70  $3.54
...
29                  Female        Heudai45  $3.47
..                     ...             ...    ...
546                   Male        Yadanu52  $2.38
547                   Male      Yadaphos40  $2.68
548                   Male         Yalae81  $3.34
What I'm aiming for currently is to find the average amount of money spent by each gender as a whole. How I imagine this would be done is by creating a method that checks for the male/female/other tag in front of a username, and then adds the average spent by that person to a running total which I can then manipulate later. Unfortunately, I'm very new to Python- I have no clue where to even begin, or if I'm even on the right track.
Addendum: jezrael misunderstood the intent of this question. While he provided me with a method to clean up my output series, he did not provide me a method or even a hint towards my main goal, which is to group together the money spent by gender (Females are shown in all but my first snippet, but there are males further down the csv file and I don't want to clog the page with too much pasta) and put them towards a single variable.
Addendum2: Another solution suggested by jezrael,
purchase_data.groupby(['Gender'])["Price"].sum().reset_index()
creates
                  Gender     Price
0                 Female   $361.94
1                   Male $1,967.64
2  Other / Non-Disclosed    $50.19
Sadly, using figures from this new series (which would yield the average price per purchase recorded in this csv) isn't quite what I'm looking for, due to the fact that certain users have purchased multiple items in the file. I'm hunting for a solution that lets me pull from my test frame the average amount of money spent per user, separated and grouped by gender.
 
     
     
     
    