I am trying to create mutliple horizontal barplots for a dataset. The data deals with race times from a running race.
Dataframe has the following columns: Name, Age Group, Finish Time, Finish Place, Hometown. Sample data below.
Name | Age Group | Finish Time | Finish Place | Hometown | Times Ran The Race |
---|---|---|---|---|---|
John | 30-39 | 15.5 | 1 | New York City | 2 |
Mike | 30-39 | 17.2 | 2 | Denver | 1 |
Travis | 40-49 | 20.4 | 1 | Louisville | 3 |
James | 40-49 | 22.1 | 2 | New York City | 1 |
I would like to create a bar plot similar to what is shown below. There would be 1 bar chart per age group, fastest runner on bottom of chart, runner name with city and number of times ran the race below their name.
Do I need a for loop or would a simple groupby work? The number and sizing of each age group can be dynamic based off the race so it is not a constant, but would be dependent on the dataframe that is used for each race.